Επεξεργασία

Κοινή χρήση μέσω


SocketOptionLevel Enum

Definition

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

Fields

Name Value Description
IP 0

Socket options apply only to IP sockets.

Tcp 6

Socket options apply only to TCP sockets.

Udp 17

Socket options apply only to UDP sockets.

IPv6 41

Socket options apply only to IPv6 sockets.

Socket 65535

Socket options apply to all sockets.

Examples

The following example uses this enumeration to set socket options.

// 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);
// The socket will linger for 10 seconds after Socket.Close is called.
var lingerOption = new LingerOption(true, 10);
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);
' 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)

Remarks

The SocketOptionLevel enumeration defines the socket option levels that can be passed to the Socket.SetSocketOption and Socket.GetSocketOption methods. SocketOptionName enumerated values are grouped by SocketOptionLevel.

Note To use IPv6 on Windows XP, install Advance Networking Pack for Windows XP.

Applies to

See also