SocketOption

Specifies a socket option:

Values

ValueMeaning
DEBUGSO_DEBUG

Record debugging information

BROADCASTSO_BROADCAST

Allow transmission of broadcast messages

REUSEADDRSO_REUSEADDR

Allow local reuse of address

REUSEPORTSO_REUSEPORT

Allow local reuse of port

On Windows, this is equivalent to SocketOption.REUSEADDR. There is in fact no option named REUSEPORT. However, SocketOption.REUSEADDR matches the behavior of SocketOption.REUSEPORT on other platforms. Further details on this topic can be found here: https://learn.microsoft.com/en-us/windows/win32/winsock/using-so-reuseaddr-and-so-exclusiveaddruse

On Linux, this ensures fair distribution of incoming connections accross threads.

See_Also: https://lwn.net/Articles/542629/

LINGERSO_LINGER

Linger on close if unsent data is present

OOBINLINESO_OOBINLINE

Receive out-of-band data in band

SNDBUFSO_SNDBUF

Send buffer size

RCVBUFSO_RCVBUF

Receive buffer size

DONTROUTESO_DONTROUTE

Do not route

SNDTIMEOSO_SNDTIMEO

Send timeout

RCVTIMEOSO_RCVTIMEO

Receive timeout

ERRORSO_ERROR

Retrieve and clear error status

KEEPALIVESO_KEEPALIVE

Enable keep-alive packets

ACCEPTCONNSO_ACCEPTCONN

Listen

RCVLOWATSO_RCVLOWAT

Minimum number of input bytes to process

SNDLOWATSO_SNDLOWAT

Minimum number of output bytes to process

TYPESO_TYPE

Socket type

TCP_NODELAY.TCP_NODELAY

Disable the Nagle algorithm for send coalescing

IPV6_UNICAST_HOPS.IPV6_UNICAST_HOPS

IP unicast hop limit

IPV6_MULTICAST_IF.IPV6_MULTICAST_IF

IP multicast interface

IPV6_MULTICAST_LOOP.IPV6_MULTICAST_LOOP

IP multicast loopback

IPV6_MULTICAST_HOPS.IPV6_MULTICAST_HOPS

IP multicast hops

IPV6_JOIN_GROUP.IPV6_JOIN_GROUP

Add an IP group membership

IPV6_LEAVE_GROUP.IPV6_LEAVE_GROUP

Drop an IP group membership

IPV6_V6ONLY.IPV6_V6ONLY

Treat wildcard bind as AF_INET6-only

Meta