Freigeben über


SocketOptionLevel-Enumeration

Definiert Socketoptionsebenen für die Socket.SetSocketOption-Methode und die Socket.GetSocketOption-Methode.

Namespace: System.Net.Sockets
Assembly: System (in system.dll)

Syntax

'Declaration
Public Enumeration SocketOptionLevel
'Usage
Dim instance As SocketOptionLevel
public enum SocketOptionLevel
public enum class SocketOptionLevel
public enum SocketOptionLevel
public enum SocketOptionLevel

Member

  Membername Beschreibung
Unterstützt von .NET Compact Framework IP Socket-Optionen gelten nur auf IP-Sockets angewendet. 
Unterstützt von .NET Compact Framework IPv6 Socket-Optionen werden nur auf IPv6-Sockets angewendet. 
Unterstützt von .NET Compact Framework Socket Socket-Optionen werden auf alle Sockets angewendet. 
Unterstützt von .NET Compact Framework Tcp Socket-Optionen werden nur auf TCP-Sockets angewendet. 
Unterstützt von .NET Compact Framework Udp Socket-Optionen werden nur auf UDP-Sockets angewendet. 

Hinweise

Die SocketOptionLevel-Enumeration definiert die Socketoptionsebenen, die an die Socket.SetSocketOption-Methode und die Socket.GetSocketOption-Methode übergeben werden können. SocketOptionName-Enumerationswerte werden nach SocketOptionLevel gruppiert.

Hinweis   Für die Verwendung von IPv6 unter Windows XP installieren Sie das Advanced Networking Pack für Windows XP.

Beispiel

Im folgenden Beispiel wird diese Enumeration zum Festlegen von Socketoptionen verwendet.

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

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

System.Net.Sockets-Namespace
Socket-Klasse
SocketOptionName