SocketOptionLevel Výčet

Definice

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
Dědičnost
SocketOptionLevel

Pole

IP 0

Socket možnosti platí jenom pro sokety IP.

IPv6 41

Socket možnosti platí pouze pro sokety IPv6.

Socket 65535

Socket možnosti platí pro všechny sokety.

Tcp 6

Socket možnosti platí pouze pro sokety TCP.

Udp 17

Socket možnosti platí pouze pro sokety UDP.

Příklady

Následující příklad používá tento výčet k nastavení možností soketu.

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

Poznámky

Výčet SocketOptionLevel definuje úrovně možností soketu, které lze předat do a Socket.SetSocketOption Socket.GetSocketOption metody. SocketOptionName výčtové hodnoty jsou seskupené podle SocketOptionLevel.

Poznámka Chcete-li použít protokol IPv6 na Windows XP, nainstalujte advance Networking Pack pro Windows XP.

Platí pro

Viz také