Following code throws exception "No such device"
,
when trying to join the multicast group (set_option
call).
#include <boost/asio.hpp>
int main(){
const std::string recv_addr = "232.4.130.147";
const int recv_port = 31338;
boost::asio::io_service io_service;
boost::asio::ip::udp::endpoint recv_endpoint(
boost::asio::ip::address::from_string(recv_addr),
recv_port);
boost::asio::ip::udp::socket recv_sock(io_service, recv_endpoint);
recv_sock.set_option(
boost::asio::ip::multicast::join_group(
boost::asio::ip::address::from_string(recv_addr).to_v4()
));
}
It happens no matter, whether network-manager is running or not. And with no regard to IP address set.
The problem arises when I connect to an internal network with IP address manually set. On the other network, where IP is obtained from DHCP I observe no problem.
I have eth0
interface up all the time and this is the only active, non-local interface.
I've tried specifying listen interface as it was shown here, but I got an exception "Invalid argument"
instead, and the Boost.Asio documentation is not saying anything about setting the interface.