Articles > Development
Printer Friendly Version
Views: 6725

Calculating the Broadcast IP Address of a Network

Last Updated: 4/3/09

While writing a Wake On LAN function for my VB.net application I found the need to calculate the broadcast ip address of the network I was communicating with. I found some code on the internet to do this, but none of it worked quite right for me when I converted the code to vb.net. I instead found this link ( http://kkkelly.com/Wk%209%20Cisco.htm ) when tells you how to calculate lots of network information using simple mathematical functions instead of bit wise operators. I hope you find this info useful.

Here are some other tips on how I got Wake On LAN to work well from my vb.net application:
- Sending one magic packet is not enough. There are many magic packet variations.
- I am sending at least four magic packets. There are two possible UDP ports (7 and 9) and I send the packet to both the broadcast ip and the direct PC ip addres..
- Read this page: http://en.wikipedia.org/wiki/Magic_packet



Keywords: vb.net calculate broadcast ip address subnet of network programming function c#