Socket Options and IOCTLs

The socket options for Winsock 2 are summarized in the following table. More detailed information is provided in section 4 under WSPGetSockOpt and/or WSPSetSockOpt. There are other new protocol-specific socket options which can be found in the protocol-specific annex.

A Windows Sockets service provider must recognize all of these options, and (for WSPGetSockOpt) 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 WSPListening. FALSE unless a WSPListen 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_GROUP_ID GROUP Reserved for future use with socket groups. The identifier of the group to which this socket belongs. NULL get only
SO_GROUP
_PRIORITY
int Reserved for future use with socket groups. The relative priority for sockets that are part of a socket group. 0
SO_KEEPALIVE BOOL Keepalives are being sent. FALSE (i)
SO_LINGER struct linger Returns the current linger options. l_onoff is 0
SO_MAX_MSG
_SIZE
int Maximum outbound size of a message for message socket types. There is no provision to determine the maximum inbound message size. Has no meaning for stream-oriented sockets. Implementation dependent get only
SO_OOBINLINE BOOL Out-of-band data is being received in the normal data stream. FALSE
SO_PROTOCOL
_INFOW
struct WSAPROTOCOL
_INFOW
Description of protocol info for protocol that is bound to this socket. protocol dependent get only
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 Total per-socket buffer space reserved for sends. This is unrelated to SO_MAX_MSG
_SIZE or the size of a TCP window.
Implementation dependent (i)
SO_TYPE int The type of the socket (e.g. SOCK_STREAM). As created via socket
PVD_CONFIG char FAR * An opaque data structure object containing configuration information of the service provider. Implementation dependent
TCP_NODELAY BOOL Disables the Nagle algorithm for send coalescing. Implementation dependent
(i)    A service provider may silently ignore this option on WSPSetSockOpt and return a constant value for WSPGetSockOpt, or it may accept a value for WSPSetSockOpt and return the corresponding value in WSPGetSockOpt without using the value in any way.