I am having a boost::asio::ip::udp::endpoint
on boost::asio::ip::address_v6::any()
(INADDR_ANY
) and some port (let's say 20000
).
Two UDP sockets now get bound to that endpoint with each subsequently joining a distingct IPv6 multicast group (let's say ff02::a
and ff02::b
) on all external network interfaces by setting the option boost::asio::ip::multicast::join_group
multiple times for the respective multicast IPv6 and interface. Also the option boost::asio::ip::udp::socket::reuse_address(true)
is getting set for both sockets.
It now appears that each of the two sockets receives UDP datagrams for both of the two multicast groups. The intended behavior is, however, that socket A only receives datagrams targeted at ff02::a
and socket B only datagrams targeted at ff02::a
.
My first try was to create two different endpoints with IPv6 addresses matching those of the respective IPv6 multicast group of the socket later to be bound to the respective endpoints. However, this leads to both sockets not receiving any datagrams at all.
How do achieve that socket A ony receives datagrams for ff02::a
and B only for ff02::b
? And why does my approach do not work?