SO_REUSEADDR
The state of the SO_REUSEADDR socket option determines whether the local transport address to which a socket will be bound is always shared with other sockets. This socket option applies only to listening sockets, datagram sockets, and connection-oriented sockets.
If a WSK application sets this socket option, it must do so before the socket is bound to a local transport address.
To set the state of this socket option, a WSK application calls the WskControlSocket function with the following parameters.
Parameter | Value |
---|---|
RequestType |
WskSetOption |
ControlCode |
SO_REUSEADDR |
Level |
SOL_SOCKET |
InputSize |
sizeof(ULONG) |
InputBuffer |
A pointer to a ULONG-typed variable that contains the value for the new state of the socket option:
|
OutputSize |
0 |
OutputBuffer |
NULL |
OutputSizeReturned |
NULL |
To retrieve the state of this socket option, a WSK application calls the WskControlSocket function with the following parameters.
Parameter | Value |
---|---|
RequestType |
WskGetOption |
ControlCode |
SO_REUSEADDR |
Level |
SOL_SOCKET |
InputSize |
0 |
InputBuffer |
NULL |
OutputSize |
sizeof(ULONG) |
OutputBuffer |
A pointer to a ULONG-typed variable that receives the value of the state of the socket option:
|
OutputSizeReturned |
NULL |
A WSK application must specify a pointer to an IRP when calling the WskControlSocket function to set or retrieve the state of the SO_REUSEADDR socket option.
The default state of this socket option is that always sharing the local transport address is disabled.
For more information about using the SO_REUSEADDR socket option and its impact on the sharing of local transport addresses between sockets, see Sharing Transport Addresses.
Requirements
Version |
Available in Windows Vista and later versions of the Windows operating systems. |
Header |
Ws2def.h (include Wsk.h) |