Boost.Asio throws an exception to such a device when trying to join a multicast group

The following code exception throws "No such device"when you try to join a multicast group (call set_option).

#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()
                ));
}

This happens whether the network manager is working or not. And without taking into account the set IP address.

The problem occurs when I connect to the internal network with a manually set IP address. In another network, where the IP is obtained from DHCP, I see no problems.

I have an interface eth0all the time and this is the only active non-local interface.

, , "Invalid argument" Boost.Asio .

+3
1

DHCP .

:

route add -net 224.0.0.0/4 dev eth0
+4

All Articles