Leggi in inglese

Condividi tramite


SocketOptionLevel Enumerazione

Definizione

C#
public enum SocketOptionLevel
Ereditarietà
SocketOptionLevel

Campi

Nome Valore Descrizione
IP 0

Le opzioni di Socket sono valide solo per i socket IP.

IPv6 41

Le opzioni di Socket sono valide solo per i socket IPv6.

Socket 65535

Le opzioni di Socket sono valide per tutti i socket.

Tcp 6

Le opzioni di Socket sono valide solo per i socket TCP.

Udp 17

Le opzioni di Socket sono valide solo per i socket UDP.

Esempio

Nell'esempio seguente viene utilizzata questa enumerazione per impostare le opzioni socket.

C#
// The socket will linger for 10 seconds after Socket.Close is called.
var lingerOption = new LingerOption(true, 10);
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);

Commenti

L'enumerazione SocketOptionLevel definisce i livelli di opzione socket che possono essere passati ai Socket.SetSocketOption metodi e Socket.GetSocketOption . SocketOptionName i valori enumerati sono raggruppati in base a SocketOptionLevel.

Nota Per usare IPv6 in Windows XP, installare Advance Networking Pack per Windows XP.

Si applica a

Prodotto Versioni
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

Vedi anche