Calculate broadcast address from ip and subnet mask
Posted
by Kolja
on Stack Overflow
See other posts from Stack Overflow
or by Kolja
Published on 2009-04-22T14:53:07Z
Indexed on
2010/05/03
19:58 UTC
Read the original article
Hit count: 407
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
© Stack Overflow or respective owner