Socket.EnableBroadcast Property

Gets or sets a Boolean value that specifies whether the Socket can send or receive broadcast packets.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

public function get EnableBroadcast () : boolean 
public function set EnableBroadcast (value : boolean)

Property Value

Type: System.Boolean
true if the Socket allows broadcast packets; otherwise, false. The default is false.

ExceptionCondition
SocketException

This option is valid for a datagram socket only.

ObjectDisposedException

The Socket has been closed.

Broadcasting is limited to a specific subnet, and must use User Datagram Protocol (UDP.) For Internet Protocol version 4, you can broadcast to your local subnet by sending a packet to 255.255.255.255; or you can use the directed broadcast address, which is the network portion of an Internet Protocol (IP) address with all bits set in the host portion. For example, if your IP address is 192.168.1.40 (a Class C address, with a netmask of 255.255.255.0 -- the network portion is the first three octets, and the host portion is the last octet), your directed broadcast address is 192.168.1.255.

Setting this property on a Transmission Control Protocol (TCP) socket will have no effect.

The following code example demonstrates the use of the EnableBroadcast property.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft