Reputation: 5083
I'm trying to join two different multicast groups from two different processes on the same machine:
Process A is getting data from 224.1.1.100:10000 just fine.
The problem is that process B is not receiving traffic from 224.1.1.101:10000 -- its instead receiving traffic from the join that process A did (224.1.1.100:10000)
The underlying code of the 2 processes is using Boost Asio. Each process is opening the socket to the same port 10000. However, each one is sending a join to a separate multicast group (process A to 224.1.1.100, process B to 224.1.1.101).
The key problem seems to be the two processes opening the socket to the same port. How can I have this work in light of having to listen to the same port on the two multicast groups (224.1.1.100 and 224.1.1.101)?
Process A example code:
listenInterface( boost::asio::ip::address::from_string( "0.0.0.0" ) ),
localEndpoint = boost::asio::ip::udp::endpoint( listenInterface, 10000 );
socket.bind( localEndpoint );
socket.set_option( boost::asio::ip::multicast::join_group( boost::asio::ip::address::from_string( "224.1.1.100" ) ) );
Process B example code:
listenInterface( boost::asio::ip::address::from_string( "0.0.0.0" ) ),
localEndpoint = boost::asio::ip::udp::endpoint( listenInterface, 10000 );
socket.bind( localEndpoint );
socket.set_option( boost::asio::ip::multicast::join_group( boost::asio::ip::address::from_string( "224.1.1.101" ) ) );
Upvotes: 0
Views: 1977
Reputation: 5083
I figured it out. The root cause was not usin a unique listenInterface between the two processes. By switching the listenInterface that is used on the bind to the local end point, I got it to work.
Upvotes: 1