0

i am trying to broadcast a UDP package using subnet. i want to braodcast my package to 192.168.1.255 ? can i do that ? and how using c++ ?

Oded
  • 664
  • 2
  • 9
  • 30
  • 1
    See this: http://stackoverflow.com/questions/337422/how-to-udp-broadcast-with-c-in-linux – nc3b May 24 '10 at 14:35

1 Answers1

1

If you're using C++, I'd recommend using the Boost ASIO package for networking. The only gotcha is to be sure to set the broadcast ability on your UDP socket via:

boost::asio::socket_base::broadcast option(true);
socket.set_option(option);

The "Examples" section of the boost documentation should have plenty of references to get you up and running.

Rakis
  • 7,779
  • 24
  • 25