Socket Name Option
Socket Name Option
Socket Name Option
Defines configuration option names.
public enum class SocketOptionName
public enum SocketOptionName
type SocketOptionName =
Public Enum SocketOptionName
|AcceptConnection AcceptConnection AcceptConnection AcceptConnection||2||
The socket is listening.
|AddMembership AddMembership AddMembership AddMembership||12||
Add an IP group membership.
|AddSourceMembership AddSourceMembership AddSourceMembership AddSourceMembership||15||
Join a source group.
|BlockSource BlockSource BlockSource BlockSource||17||
Block data from a source.
|Broadcast Broadcast Broadcast Broadcast||32||
Permit sending broadcast messages on the socket.
|BsdUrgent BsdUrgent BsdUrgent BsdUrgent||2||
Use urgent data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off.
|ChecksumCoverage ChecksumCoverage ChecksumCoverage ChecksumCoverage||20||
Set or get the UDP checksum coverage.
|Debug Debug Debug Debug||1||
Record debugging information.
|DontFragment DontFragment DontFragment DontFragment||14||
Do not fragment IP datagrams.
|DontLinger DontLinger DontLinger DontLinger||-129||
Close the socket gracefully without lingering.
|DontRoute DontRoute DontRoute DontRoute||16||
Do not route; send the packet directly to the interface addresses.
|DropMembership DropMembership DropMembership DropMembership||13||
Drop an IP group membership.
|DropSourceMembership DropSourceMembership DropSourceMembership DropSourceMembership||16||
Drop a source group.
|Error Error Error Error||4103||
Get the error status and clear.
|ExclusiveAddressUse ExclusiveAddressUse ExclusiveAddressUse ExclusiveAddressUse||-5||
Enables a socket to be bound for exclusive access.
|Expedited Expedited Expedited Expedited||2||
Use expedited data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off.
|HeaderIncluded HeaderIncluded HeaderIncluded HeaderIncluded||2||
Indicates that the application provides the IP header for outgoing datagrams.
|HopLimit HopLimit HopLimit HopLimit||21||
Specifies the maximum number of router hops for an Internet Protocol version 6 (IPv6) packet. This is similar to Time to Live (TTL) for Internet Protocol version 4.
|IPOptions IPOptions IPOptions IPOptions||1||
Specifies the IP options to be inserted into outgoing datagrams.
|IPProtectionLevel IPProtectionLevel IPProtectionLevel IPProtectionLevel||23||
Enables restriction of a IPv6 socket to a specified scope, such as addresses with the same link local or site local prefix.This socket option enables applications to place access restrictions on IPv6 sockets. Such restrictions enable an application running on a private LAN to simply and robustly harden itself against external attacks. This socket option widens or narrows the scope of a listening socket, enabling unrestricted access from public and private users when appropriate, or restricting access only to the same site, as required. This socket option has defined protection levels specified in the IPProtectionLevel enumeration.
|IpTimeToLive IpTimeToLive IpTimeToLive IpTimeToLive||4||
Set the IP header Time-to-Live field.
|IPv6Only IPv6Only IPv6Only IPv6Only||27||
Indicates if a socket created for the AF_INET6 address family is restricted to IPv6 communications only. Sockets created for the AF_INET6 address family may be used for both IPv6 and IPv4 communications. Some applications may want to restrict their use of a socket created for the AF_INET6 address family to IPv6 communications only. When this value is non-zero (the default on Windows), a socket created for the AF_INET6 address family can be used to send and receive IPv6 packets only. When this value is zero, a socket created for the AF_INET6 address family can be used to send and receive packets to and from an IPv6 address or an IPv4 address. Note that the ability to interact with an IPv4 address requires the use of IPv4 mapped addresses. This socket option is supported on Windows Vista or later.
|KeepAlive KeepAlive KeepAlive KeepAlive||8||
|Linger Linger Linger Linger||128||
Linger on close if unsent data is present.
|MaxConnections MaxConnections MaxConnections MaxConnections||2147483647||
Not supported; will throw a SocketException if used.
|MulticastInterface MulticastInterface MulticastInterface MulticastInterface||9||
Set the interface for outgoing multicast packets.
|MulticastLoopback MulticastLoopback MulticastLoopback MulticastLoopback||11||
An IP multicast loopback.
|MulticastTimeToLive MulticastTimeToLive MulticastTimeToLive MulticastTimeToLive||10||
An IP multicast Time to Live.
|NoChecksum NoChecksum NoChecksum NoChecksum||1||
Send UDP datagrams with checksum set to zero.
|NoDelay NoDelay NoDelay NoDelay||1||
Disables the Nagle algorithm for send coalescing.
|OutOfBandInline OutOfBandInline OutOfBandInline OutOfBandInline||256||
Receives out-of-band data in the normal data stream.
|PacketInformation PacketInformation PacketInformation PacketInformation||19||
Return information about received packets.
|ReceiveBuffer ReceiveBuffer ReceiveBuffer ReceiveBuffer||4098||
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.
|ReceiveLowWater ReceiveLowWater ReceiveLowWater ReceiveLowWater||4100||
Specifies the low water mark for Receive operations.
|ReceiveTimeout ReceiveTimeout ReceiveTimeout ReceiveTimeout||4102||
Receive a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend(Byte, Int32, Int32, SocketFlags, AsyncCallback, Object) method.
|ReuseAddress ReuseAddress ReuseAddress ReuseAddress||4||
Allows the socket to be bound to an address that is already in use.
|ReuseUnicastPort ReuseUnicastPort ReuseUnicastPort ReuseUnicastPort||12295||
Indicates that the system should defer ephemeral port allocation for outbound connections. This is equivalent to using the Winsock2 SO_REUSE_UNICASTPORT socket option.
|SendBuffer SendBuffer SendBuffer SendBuffer||4097||
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.
|SendLowWater SendLowWater SendLowWater SendLowWater||4099||
Specifies the low water mark for Send operations.
|SendTimeout SendTimeout SendTimeout SendTimeout||4101||
Send a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend(Byte, Int32, Int32, SocketFlags, AsyncCallback, Object) method.
|Type Type Type Type||4104||
Get the socket type.
|TypeOfService TypeOfService TypeOfService TypeOfService||3||
Change the IP header type of the service field.
|UnblockSource UnblockSource UnblockSource UnblockSource||18||
Unblock a previously blocked source.
|UpdateAcceptContext UpdateAcceptContext UpdateAcceptContext UpdateAcceptContext||28683||
Updates an accepted socket's properties by using those of an existing socket. This is equivalent to using the Winsock2 SO_UPDATE_ACCEPT_CONTEXT socket option and is supported only on connection-oriented sockets.
|UpdateConnectContext UpdateConnectContext UpdateConnectContext UpdateConnectContext||28688||
Updates a connected socket's properties by using those of an existing socket. This is equivalent to using the Winsock2 SO_UPDATE_CONNECT_CONTEXT socket option and is supported only on connection-oriented sockets.
|UseLoopback UseLoopback UseLoopback UseLoopback||64||
Bypass hardware when possible.
The following code 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)