SocketOptionLevel Enumeração

Definição

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
Herança
SocketOptionLevel

Campos

IP 0

As opções Socket se aplicam aos soquetes IP.

IPv6 41

As opções Socket se aplicam aos soquetes IPv6.

Socket 65535

As opções Socket se aplicam a todos os soquetes.

Tcp 6

As opções Socket se aplicam aos soquetes TCP.

Udp 17

As opções Socket se aplicam aos soquetes UDP.

Exemplos

O exemplo a seguir usa essa enumeração para definir opções de soquete.

// 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)

Comentários

A SocketOptionLevel enumeração define os níveis de opção de soquete que podem ser passados para os métodos e Socket.GetSocketOption para os Socket.SetSocketOption métodos. SocketOptionName Os valores enumerados são agrupados por SocketOptionLevel.

Nota Para usar o IPv6 em Windows XP, instale o Pacote de Rede Avançada para Windows XP.

Aplica-se a

Confira também