Multicast with QUdpSocket and QHostAddress::Any does not work
-
For some reason I just recently ran into an issue with this.
I configure the bind the following way:
m_udpSocket.bind(QHostAddress::Any, 2222);
then eventually when I want to respond to a message I call:
qint64 dataWritten = poUdpSocketIo->writeDatagram(Data, qhaIPv4Addr, 2222);
a qDebug() message is printed that showns:
SUCCESS on writeDatagram() | dataWritten: 128 | Data.size(): 128
However, when I use Wireshark I can see that this message never goes out on the wire.
If I change the bind call to the following:
m_udpSocket.bind(QHostAddress("192.168.100.3"), 2222);
This multicast works perfectly fine and I can see packets being sent to multicast address 239.192.1.65.
I have another computer setup with Windows 7 just like this failing one and I can see that even with QHostAddress::Any this still works.
What could be wrong? Why is the multicast not working when the bind() call is passed QHostAddress::Any when it used to work and it works this way on another computer?
-
Hi,
On what OS/Qt combo do you have the failure ?
-
And it's falling only on that one computer ?
-
@SGaist Yes, it used to work on that computer previously.
The only difference I have noticed so far it he following output using command prompt:
FAILING COMPUTER
C:\>netsh interface ip show join "Local Area Connection" Interface 11: Local Area Connection Multicast Address : 224.0.0.1 Scope : 0 References : 0 Last Reporter? : Yes Multicast Address : 224.0.0.252 Scope : 0 References : 1 Last Reporter? : Yes Multicast Address : 239.255.255.250 Scope : 0 References : 2 Last Reporter? : Yes C:\>
WORKING COMPUTER
C:\>netsh interface ip show join "Local Area Connection" Interface 13: Local Area Connection Multicast Address : 224.0.0.1 Scope : 0 References : 0 Last Reporter? : Yes C:\>
I'm not sure if it is because the failing computer is showing two more Multicast Addressed. In which case I don't know how to remove the other two addresses.
-
Got several network cards ?
-
Did you check with the latest Qt 5.5 if you still experience this behavior ?