Send a Broadcast Message
Problem
You want to send a message to every user on the local subnet.
Solution
Use the UdpClient class with the appropriate broadcast address.
Discussion
Broadcasts are network messages that are forwarded to all the devices on a local subnet. When a broadcast message is received, the client decides whether to discard (depending on whether any application is monitoring the appropriate port). Broadcasts can’t travel beyond a subnet because routers block all broadcast messages. Otherwise, the network could be swamped in traffic.
To send a broadcast message, you use a broadcast IP address, which is the IP address that identifies the network and has all the host bits set to 1. For example, if the network is identified by the first ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.