2.4 Socket Options

The socket options supported by Windows Sockets are listed in the pages describing setsockopt() and getsockopt(). A Windows Sockets implementation must recognize all of these options, and (for getsockopt()) return plausible values for each. The default value for each option is shown in the following table.

Value

Type

Meaning

Default

Note

SO_ACCEPTCONN

BOOL

Socket is listen()ing.

FALSE unless a listen() has been performed

SO_BROADCAST

BOOL

Socket is configured for the transmission of broadcast messages.

FALSE

SO_DEBUG

BOOL

Debugging is enabled.

FALSE

(i)

SO_DONTLINGER

BOOL

If true, the SO_LINGER option is disabled.

TRUE

SO_DONTROUTE

BOOL

Routing is disabled.

FALSE

(i)

SO_ERROR

int

Retrieve error status and clear.

0

SO_KEEPALIVE

BOOL

Keepalives are being sent.

FALSE

SO_LINGER

struct linger FAR *

Returns the current linger options.

l_onoff is 0

SO_OOBINLINE

BOOL

Out-of-band data is being received in the normal data stream.

FALSE

SO_RCVBUF

int

Buffer size for receives

Implementation dependent

(i)

SO_REUSEADDR

BOOL

The address to which this socket is bound can be used by others.

FALSE

SO_SNDBUF

int

Buffer size for sends

Implementation dependent

(i)

SO_TYPE

int

The type of the socket (e.g. SOCK_STREAM).

As created via socket()

TCP_NODELAY

BOOL

Disables the Nagle algorithm for send coalescing.

Implementation dependent


Notes:

(i) An implementation may silently ignore this option on setsockopt() and return a constant value for getsockopt(), or it may accept a value for setsockopt() and return the corresponding value in getsockopt() without using the value in any way.