SocketOptionLevel Énumération

Définition

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
Héritage
SocketOptionLevel

Champs

IP 0

Les options Socket s'appliquent uniquement aux sockets IP.

IPv6 41

Les options Socket s'appliquent uniquement aux sockets IPv6.

Socket 65535

Les options Socket s'appliquent à tous les sockets.

Tcp 6

Les options Socket s'appliquent uniquement aux sockets TCP.

Udp 17

Les options Socket s'appliquent uniquement aux sockets UDP.

Exemples

L’exemple suivant utilise cette énumération pour définir les options de 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)

Remarques

L’énumération SocketOptionLevel définit les niveaux d’option de socket qui peuvent être passés aux méthodes et Socket.GetSocketOption aux Socket.SetSocketOption méthodes. SocketOptionName les valeurs énumérées sont regroupées par SocketOptionLevel.

Note Pour utiliser IPv6 sur Windows XP, installez Advance Networking Pack pour Windows XP.

S’applique à

Voir aussi