I am trying to implement IPv6 multicast using boost library (1.61.0). However, I am getting the following error in macOS (OSX 10.10, 10.11, 10.12) and only for link-local (Global IPv6 works). I do not get this error on Ubuntu (14.04, 16.04, 17.10). The netif.getIndex() gets the interface index for link-local. Where am I doing wrong?
Error:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >: set_option: Can't assign requested address
Here's my code segment for IPv6 multicast:
receiveSocket.bind(udp::Endpoint(localEndpoint.address(), multicastEndpoint.port()));
receiveSocket.set_option(ip::multicast::join_group(multicastEndpoint.address().to_v6()));
if (!localEndpoint.address().is_unspecified()) {
sendSocket.set_option(ip::multicast::outbound_interface(netif.getIndex()));
}
sendSocket.set_option(ip::multicast::join_group(multicastEndpoint.address().to_v6()));