I'm writing a C++ program, where I want to get broadcast IP of the
machine I'm running it. Is there a function to do this? or how can I
get this infomation?
Thanks in advance,
(address & mask) | (INADDR_BROADCAST & !mask)
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Here's the scenario. I am given an IP address, and told to send a UDP
packet to the broadcast. I open the socket, and setsockopt to
SO_BROADCAST. Now comes the tricky part. How can I figure out the
broadcast address for the network specified in the given IP address?
I don't want to have my users plunking around with netmasks to figure
out which bits are set to 1.
I also realize that this is OS dependent (I believe) and may not be
portable. So I'd appreciate seeing some examples to get me started.
I can always cruise through TFM once I figure out a good starting
As always, thanks in advance for any light you could shed on this
Jeffrey L. Bromberger -- Postmaster At Large -- ILX Systems, Inc.