[asio] Using struct ip_mreqn to joing multicast group
Hi, I need to receive multicasts on multiple interfaces and handle them differently, depending on the network interface they arrived on. For each network interface, I create an UDP socket and I use Socket.set_option(boost::asio::ip::multicast::join_group(MCastReqAddr.to_v4(), LocalAddr.to_v4() ), ec); to join the multicast group. LocalAddr is the local IPv4 address of the interface. Unfortunately, I receive each incoming multicast message on each socket. I found, that boost::asio::ip::multicast::join_group uses struct ip_mreq, where the multicast address and the local address can be specified. On linux the man page on IP_ADD_MEMBERSHIP tells to use struct ip_mreqn. This structure had an additional member imr_ifindex. The documentation is not very clear about the difference between imr_address and imr_ifindex. So, I want to try it out and wonder, whether boost::asio supports using struct ip_mreqn for IP_ADD_MEMBERSHIP. If not, does anybody know, how to write my own class to be used with Socket.set_option? 73, Mario -- Mario Klebsch Actia I+ME GmbH Mario.klebsch@ime-actia.demailto:Mario.klebsch@ime-actia.de Dresdenstrasse 17/18 Fon: +49 531 38 701 716 38124 Braunschweig Fax: +49 531 38 701 88 Germany
participants (1)
-
Klebsch, Mario