public enum SocketOptionLevel
Object
ValueType
Enum
SocketOptionLevel
System
Networking
Specifies the option level associated with the SocketOptionName used in the System.Net.Sockets.Socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,System.Int32) and System.Net.Sockets.Socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName) methods of the Socket class.
Some socket options apply only to specific protocols while others apply to all types. Members of this enumeration specify which protocol applies to a specific socket option.
System.Net.Sockets Namespace
SocketOptionLevel Fields
SocketOptionLevel.IP Field
SocketOptionLevel.Socket Field
SocketOptionLevel.Tcp Field
SocketOptionLevel.Udp Field
SocketOptionLevel.value__ Field
IP = 0;
Specifies that members of the SocketOptionName enumeration apply to Internet Protocol (IP).The following table lists the members of the SocketOptionName enumeration used with this level.
SocketOptionName Description of Socket Option Data HeaderIncluded A Boolean where true
indicates the application is providing the IP header for outgoing datagrams.IPOptions A Byte array that specifies IP options to be inserted into outgoing datagrams. IpTimeToLive A Int32 that specifies the time-to-live for datagrams. The time-to-live designates the number of networks on which the datagram is allowed to travel before being discarded by a router. MulticastInterface A Byte array that specifies the interface for outgoing multicast packets. MulticastLoopback A Boolean where true
enables multicast loopback.MulticastTimeToLive A Int32 that specifies the time-to-live for multicast datagrams. TypeOfService A Int32 that specifies the type of service field in the IP header. UseLoopback A Boolean where true
indicates Bypass hardware when possible.
System.Net.Sockets.SocketOptionLevel Enum, System.Net.Sockets Namespace
Socket = 65535;
Specifies that members of the SocketOptionName enumeration are not specific to a particular protocol.The following table lists the members of the SocketOptionName enumeration used with this level.
SocketOptionName Description Broadcast A Boolean where true
indicates broadcast messages are allowed to be sent to the socket.Debug A Boolean where true
indicates to record debugging information.DontLinger A Boolean where true
indicates to close the socket without lingering.DontRoute A Boolean where true
indicates not to route data;false
indicates to send data directly to interface addresses.Error A Int32 that contains the error code associated with the last socket error. The error code is cleared by this option. This option is read-only. KeepAlive A Boolean where true
(the default) indicates to enable keep-alives, which allows a connection to remain open after a request.OutOfBandInline A Boolean where true
indicates to receive out-of-band data in the normal data stream.ReceiveBuffer A Int32 that specifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window. ReceiveTimeout A Int32 that specifies the maximum time, in milliseconds, the System.Net.Sockets.Socket.Receive(System.Byte[],System.Int32,System.Net.Sockets.SocketFlags) and System.Net.Sockets.Socket.ReceiveFrom(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.Net.EndPoint@) methods will block when attempting to receive data. If data is not received within this time, a SocketException exception is thrown. ReuseAddress A Boolean where true
allows the socket to be bound to an address that is already in use.SendBuffer A Int32 that specifies the total per-socket buffer space reserved for sends. This is unrelated to the maximum message size or the size of a TCP window. SendTimeout A Int32 that specifies the maximum time, in milliseconds, the System.Net.Sockets.Socket.Send(System.Byte[],System.Int32,System.Net.Sockets.SocketFlags) and System.Net.Sockets.Socket.SendTo(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.Net.EndPoint) methods will block when attempting to send data. If data is not sent within this time, a SocketException exception is thrown. Type One of the values defined in the SocketType enumeration. This option is read-only.
System.Net.Sockets.SocketOptionLevel Enum, System.Net.Sockets Namespace
Tcp = 6;
Specifies that members of the SocketOptionName enumeration apply to Transmission Control Protocol (TCP).The following table lists the members of the SocketOptionName enumeration used with this level.
SocketOptionName Description of Socket Option Data BsdUrgent A Boolean where true
indicates to use urgent data as defined by IETF RFC 1222. Once set, this option cannot be turned off.Expedited A Boolean where true
indicates to use expedited data as defined by IETF RFC 1222. Once set, this option cannot be turned off.NoDelay A Boolean where true
indicates to disable the Nagle algorithm for send coalescing.
System.Net.Sockets.SocketOptionLevel Enum, System.Net.Sockets Namespace
Udp = 17;
Specifies that members of the SocketOptionName enumeration apply to User Datagram Protocol (UDP).The following table lists the members of the SocketOptionName enumeration used with this level.
SocketOptionName Description of Socket Option Data ChecksumCoverage A Boolean that specifies UDP checksum coverage. NoChecksum A Boolean where true
indicates to send UDP datagrams with the checksum set to zero.
System.Net.Sockets.SocketOptionLevel Enum, System.Net.Sockets Namespace
value__;
System.Net.Sockets.SocketOptionLevel Enum, System.Net.Sockets Namespace