Calculate broadcast address from ip and subnet mask
- by Kolja
Hi
I want to calculate the broadcast address for e.g
-IP 192.168.3.1
-Subnet 255.255.255.0
=192.168.3.255
in C.
I know the way (doing fancy bitwise OR's between the inversed IP and Subnet), but my problem is I come from the green fields of MacOSX Cocoa programing. I looked into the source of ipcal, but wasn't able to integrate it into my code base. There must be a simple 10 line of code example somewhere on the internet, I just can't find it.
Could someone point me to a 10 line of code example of how to do it in C.
Cheers,
Kolja