|
Boost Users : |
Subject: Re: [Boost-users] [asio] What have to be done to receive UDP broadcast packets?
From: Michael Schulze (mschulze_at_[hidden])
Date: 2011-03-22 09:57:59
Hi list,
sorry for the noise. It works as it should and the setup I did is
correct. Now it works and I do not know why it does not beforehand.
Regards,
Michael
> I struggle with setting up an asio udp socket on Linux that is able to
> receive broadcasts. I managed the sending of broadcasts, but receiving
> seems to have a problem. I also managed sending and receiving of
> broadcasts with the native socket api of Linux. However, in the project
> we use asio to have portability across platforms and therewith we need
> to receive broadcast with asio too.
>
> The question is: How should an asio udp socket be setup in order to
> receive broadcasts?
>
> I did the following:
>
> udp::socket socket(io_service);
> socket.open(udp::v4());
> boost::asio::socket_base::broadcast option(true);
> socket.set_option(option);
> socket.bind(udp::endpoint(address_v4::any(),8888));
>
> and then I started receive_from.
>
> What is wrong with this? I did not receive the sent broadcast.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net