SocketOptionLevel Enumeración

Definición

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
Herencia
SocketOptionLevel

Campos

IP 0

Las opciones de Socket sólo se aplican a los sockets IP.

IPv6 41

Las opciones de Socket se aplican sólo a sockets de IPv6.

Socket 65535

Las opciones de Socket se aplican a todos los sockets.

Tcp 6

Las opciones de Socket solo se aplican a los sockets TCP.

Udp 17

Las opciones de Socket solo se aplican a los sockets UDP.

Ejemplos

En el ejemplo siguiente se usa esta enumeración para establecer las opciones 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)

Comentarios

La SocketOptionLevel enumeración define los niveles de opción de socket que se pueden pasar a los Socket.SetSocketOption métodos y Socket.GetSocketOption . SocketOptionName los valores enumerados se agrupan mediante SocketOptionLevel.

Nota Para usar IPv6 en Windows XP, instale Advance Networking Pack para Windows XP.

Se aplica a

Consulte también