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.Socket options apply only to IP sockets.

IPv6 41

As opções Socket se aplicam aos soquetes IPv6.Socket options apply only to IPv6 sockets.

Socket 65535

As opções Socket se aplicam a todos os soquetes.Socket options apply to all sockets.

Tcp 6

As opções Socket se aplicam aos soquetes TCP.Socket options apply only to TCP sockets.

Udp 17

As opções Socket se aplicam aos soquetes UDP.Socket options apply only to UDP sockets.

Exemplos

O exemplo a seguir usa essa enumeração para definir opções de soquete.The following example uses this enumeration to set socket options.

// 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 Socket.SetSocketOption Socket.GetSocketOption métodos e.The SocketOptionLevel enumeration defines the socket option levels that can be passed to the Socket.SetSocketOption and Socket.GetSocketOption methods. SocketOptionName os valores enumerados são agrupados por SocketOptionLevel .SocketOptionName enumerated values are grouped by SocketOptionLevel.

Observação Para usar o IPv6 no Windows XP, instale o pacote de rede avançado para o Windows XP.Note To use IPv6 on Windows XP, install Advance Networking Pack for Windows XP.

Aplica-se a

Confira também