mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
SF#3563627: Set IP address on multicast socket from socket family
This commit is contained in:
@@ -97,16 +97,18 @@ MulticastSocket& MulticastSocket::operator = (const Socket& socket)
|
||||
|
||||
void MulticastSocket::setInterface(const NetworkInterface& interfc)
|
||||
{
|
||||
if (!interfc.supportsIPv6())
|
||||
if (address().family() == IPAddress::IPv4)
|
||||
{
|
||||
impl()->setOption(IPPROTO_IP, IP_MULTICAST_IF, interfc.firstAddress(IPAddress::IPv4));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (address().family() == IPAddress::IPv6)
|
||||
{
|
||||
impl()->setOption(IPPROTO_IPV6, IPV6_MULTICAST_IF, interfc.index());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
else
|
||||
throw UnsupportedFamilyException("Unknown or unsupported socket family.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user