SO_BROADCAST

The state of the SO_BROADCAST socket option determines whether broadcast messages can be transmitted over a datagram socket. This socket option applies only to datagram sockets.

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_BROADCAST

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: Do not allow broadcast messages

1: Allow broadcast messages

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_BROADCAST

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: Broadcast messages are not allowed

1: Broadcast messages are allowed

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

The default state of this socket option is that broadcast messages are not allowed.

Requirements

Version

Available in Windows Vista and later versions of the Windows operating systems.

Header

Ws2def.h (include Wsk.h)