[Interest] QUdpSocket multicast on multiple network interfaces

Thiago Macieira thiago.macieira at intel.com
Thu Feb 20 05:30:20 CET 2014


Em qua 19 fev 2014, às 23:27:38, Tom Isaacson escreveu:
> We're using Qt 4.8.2 on an embedded Linux device. We've always had Ethernet
> (eth0) and we use QUdpSocket to send a multicast message on the network:
> 
>     m_pUdpSocket = new QUdpSocket(this);
>     m_pUdpSocket->writeDatagram(json.toAscii(), m_cMulticastAddr,
> m_cMulticastPort);
> 
> This works fine, but recently we've started testing with a Wifi interface as
> well. What we've found is that this code only transmits the multicast on
> Ethernet and ignores the Wifi. From the application we have to create a
> second QUdpSocket and bind it to the IP address of the Wifi interface. I
> would have expected Qt to transmit on all available network interfaces. 

> - Is this a known bug? If so, is it fixed in a later release?
> - Is this working as intended?

It's working as intended. That's how IP works (both v4 and v6).

Did you use joinMulticastGroup? Or do you just want to send to the group, but 
not receive from it? If so, did you use setMulticastInterface?

If you're sending to hosts in your local network only, you should use IPv6 
because then you can simply set the destination interface in the scopeid of 
the address.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list