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 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.
Value
Type
Meaning
Default
Note
SO_ACCEPTCONN
BOOL
Socket is listening.
FALSE unless a WSPListen has been performed.
SO_BROADCAST
BOOL
Socket is configured for the transmission and receipt 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. 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_ERROR
int
Retrieves error status and clear.
0
SO_GROUP_ID
GROUP
Reserved.
NULL
Get only
SO_GROUP_PRIORITY
int
Reserved.
0
BOOL
Keepalives are being sent. Not supported on ATM sockets (results in an error).
FALSE
(i)
SO_LINGER
Structure 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
OOB data is being received in the normal data stream.
FALSE
SO_PROTOCOL_INFOW
structure WSAPROTOCOL_INFO
Description of protocol information for the protocol that is bound to this socket.
Protocol dependent
Get only
SO_RCVBUF
int
The 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_REUSEADDR
BOOL
The address to which this socket is bound can be used by others. Not applicable on ATM sockets.
FALSE
SO_SNDBUF
int
The 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_TYPE
int
The type of the socket (for example, SOCK_STREAM).
As created through 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.
Related topics