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’option 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
| Nom | Valeur | Description |
|---|---|---|
| IP | 0 | Socket les options s’appliquent uniquement aux sockets IP. |
| Tcp | 6 | Socket les options s’appliquent uniquement aux sockets TCP. |
| Udp | 17 | Socket les options s’appliquent uniquement aux sockets UDP. |
| IPv6 | 41 | Socket les options s’appliquent uniquement aux sockets IPv6. |
| Socket | 65535 | Socket les options s’appliquent à tous les sockets. |
Exemples
L’exemple suivant utilise cette énumération pour définir les options de socket.
// 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);
' 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.