tags:

views:

35

answers:

1

I'm working on broadcast, and I'm failing pretty badly at even getting the thing to work. I know I have to do the setsockopt() call, but what is needed before that to ensure that the broadcast will go to every box on the network? I vaguely remember something about complementing the network address or something like that. I appreciate the help.

+1  A: 

You don't need to use setsockopt(). A UDP packet sent to the special address 255.255.255.255 will be sent to all addresses on the local network.

If the network you want to broadcast to is not local you need to use the broadcast address of that network (as per ivymike's comment), which by convention is normally (but not always) the last IP in the subnet.

Bear in mind that broadcast addresses are used in a number of DOS attacks and are likely to be filtered.

SteveRawlinson
This was the answer, thanks so much!
evantravers