Opened 13 years ago

Last modified 10 years ago

#3247 new Bugs

Multicast join group does not honor interface specification

Reported by: Dale Wilson <wilson@…> Owned by: chris_kohlhoff
Milestone: Boost 1.40.0 Component: asio
Version: Boost 1.39.0 Severity: Problem
Keywords: multicast interface Cc:

Description

I'm working with the Multicast receiver example at:

http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/multicast/receiver.cpp

Notice that you specify the listen_address as you create the endpoint that is bound to the socket. Later when you call socket::set_option with the multicast_address, I would expect the listen_address to be honored. The current implementation uses INET_ANY for the interface in the multicast subscription. This means the multicast messages may arrive on one interface while you are listening for them on another one. I can't think of any case in which you would want to specify an IP for the receive, but not for the join_group and it certainly shouldn't be the default behavior when you use the example code as a guide.

Workaround: There is a different constructor for the join_group object that does produce the desired behavior, but it is not obvious that you should need it. Also it does not accept boost::asio::ip::addresses as arguments (which would make sense) but requires that you "convert" them to ip4 (or ip6) addresses. Seems awkward.

Change History (1)

comment:1 by anonymous, 10 years ago

join_group(multicast_address, listening_address) only works with ip4... not ip6, and 4 years later, it's still not documented

Note: See TracTickets for help on using tickets.