SocketOptionLevel Enumerazione

Definizione

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
Ereditarietà
SocketOptionLevel

Campi

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 usata questa enumerazione per impostare le opzioni socket.

// Specifies that send operations will time-out 
// if confirmation is not received within 1000 milliseconds.
s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 1000 );

// Specifies that the Socket will linger for 10 seconds after Close is called.
LingerOption^ lingerOption = gcnew LingerOption( true,10 );

s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption );
// Send operations will time-out if confirmation
// is not received within 1000 milliseconds.
s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000);

// The socket will linger for 10 seconds after Socket.Close is called.
LingerOption lingerOption = new LingerOption (true, 10);

s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);
'Send operations will time-out if confirmation is 
' not received within 1000 milliseconds.
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000)

' The socket will linger for 10 seconds after Socket.Close is called.
Dim lingerOption As 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

Vedi anche