SocketOptionLevel Énumération
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Définit les niveaux d'options de socket pour les méthodes SetSocketOption(SocketOptionLevel, SocketOptionName, Int32) et GetSocketOption(SocketOptionLevel, SocketOptionName).
public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel =
Public Enum SocketOptionLevel
- Héritage
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.