Discussion Locked

Broadcasting Data Grams

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hai,
Please provide me with some working code that broadcasts a datagram over the local area netwrok. I have tried using setsockopt but it gives me error if I set the SO_BROADCAST FLAG AT THE SOL_SOCKET LEVEL. I will be grateful to you if you get me out of it.
Thank you

1 reply

by dsr28

You just need to "send" the UPD packet to the broadcast address for the network, and it will be broadcast!

(The broadcast network address is the last address in the subnet) For example, with a netmask of 255.255.255.0, the bcast address for IP address block 192.168.1.1 is 192.168.1.255.

I hope this helps

This discussion is closed to new replies.