Socket Options and IOCTLs

Some of the socket options for Windows Sockets 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 complete list of Socket Options for Windows Sockets are available in the Winsock reference.

For a a summary of some of the Winsock Ioctls, see Summary of Socket Ioctl Opcodes. A complete list of Winsock IOCTLs are available in the Winsock reference.

Summary of Common Socket Options

A Winsock 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.

SO_ACCEPTCONNBOOLSocket is listening.FALSE unless a WSPListen has been performed.
SO_BROADCASTBOOLSocket is configured for the transmission and receipt of broadcast messages.FALSE
SO_DEBUGBOOLDebugging is enabled.FALSE(i)
SO_DONTLINGERBOOLIf true, the SO_LINGER option is disabled.TRUE
SO_DONTROUTEBOOLRouting is disabled. Succeeds but is ignored on AF_INET sockets; fails on AF_INET6 sockets with WSAENOPROTOOPT. Not supported on ATM sockets (results in an error).FALSE(i)
SO_ERRORintRetrieves error status and clear.0
SO_KEEPALIVE BOOLKeepalives are being sent. Not supported on ATM sockets (results in an error).FALSE(i)
SO_LINGERStructure lingerReturns the current linger options.l_onoff is 0
SO_MAX_MSG_SIZEintMaximum 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 dependentGet only
SO_OOBINLINEBOOLOOB data is being received in the normal data stream.FALSE
SO_PROTOCOL_INFOWstructure WSAPROTOCOL_INFO Description of protocol information for the protocol that is bound to this socket.Protocol dependentGet only
SO_RCVBUFintThe total per-socket buffer space reserved for receives. This is unrelated to SO_MAX_MSG_SIZE and does not necessarily correspond to the size of the TCP receive window. Implementation dependent(i)
SO_REUSEADDRBOOLThe address to which this socket is bound can be used by others. Not applicable on ATM sockets.FALSE
SO_SNDBUFintThe total per-socket buffer space reserved for sends. This is unrelated to SO_MAX_MSG_SIZE and does not necessarily correspond to the size of a TCP send window.Implementation dependent(i)
SO_TYPEintThe type of the socket (for example, SOCK_STREAM).As created through socket.
PVD_CONFIGchar FAR *An opaque data structure object containing configuration information of the service provider.Implementation dependent
TCP_NODELAYBOOLDisables 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.


Related topics

Socket Options
SOL_SOCKET Socket Options
IPPROTO_TCP Socket Options
IPPROTO_UDP Socket Options
Winsock IOCTLs