SO_EXCLUSIVEADDRUSE

The state of the SO_EXCLUSIVEADDRUSE socket option determines whether the local transport address to which a socket will be bound is exclusively reserved for use by that socket. 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_EXCLUSIVEADDRUSE

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:

0: Disable exclusive use of the local transport address

1: Enable exclusive use of the local transport address

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_EXCLUSIVEADDRUSE

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:

0: Exclusive use of the local transport address is disabled

1: Exclusive use of the local transport address is enabled

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_EXCLUSIVEADDRUSE socket option.

The default state of this socket option is that exclusive use of the local transport address is disabled.

For more information about using the SO_EXCLUSIVEADDRUSE 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)