
Il 4/4/2012 9:31 AM, Gianni Ambrosio ha scritto:
void BoostUdpSocketMulticast::receiveFrom(const std::string& iMulticastAddress, const unsigned short iMulticastPort) { boost::system::error_code error; boost::asio::ip::address_v4 m_address = boost::asio::ip::address_v4::from_string(iMulticastAddress, error); boost::asio::ip::address_v4 l_address = boost::asio::ip::address_v4::from_string("192.168.0.85", error); endpoint=boost::asio::ip::udp::endpoint(l_address, iMulticastPort); socket.open(endpoint.protocol()); socket.set_option(boost::asio::ip::udp::socket::reuse_address(true)); socket.bind(endpoint); // join the multicast group on a specific interface boost::asio::ip::multicast::join_group option(m_address,l_address); socket.set_option(option); }
Why boost join_group does not work with a general boost::asio::ip::address and an explicit conversion to ipv4 or ipv6? It seems it should be transparent just like other piece of boost code. Regards Gianni