UdpClient.EnableBroadcast Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
property bool EnableBroadcast { bool get(); void set(bool value); };
public bool EnableBroadcast { get; set; }
member this.EnableBroadcast : bool with get, set
Public Property EnableBroadcast As Boolean
Property Value
true
if the UdpClient allows sending broadcast packets; otherwise, false
. The default is false
.
Examples
The following code example shows the use of the EnableBroadcast property.
static void GetSetEnableBroadcast( UdpClient^ u )
{
// Set the Broadcast flag for this client.
u->EnableBroadcast = true;
Console::WriteLine( "EnableBroadcast value is {0}", u->EnableBroadcast );
}
public static void GetSetEnableBroadcast(UdpClient u)
{
// Set the Broadcast flag for this client.
u.EnableBroadcast = true;
Console.WriteLine("EnableBroadcast value is {0}",
u.EnableBroadcast);
}
Remarks
Broadcasting is limited to a specific subnet. 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 the network portion as the first three octets, and the host portion is the last octet), your directed broadcast address is 192.168.1.255.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om