Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Multicast with QUdpSocket and QHostAddress::Any does not work
kzawada last edited by kzawada
For some reason I just recently ran into an issue with this.
I configure the bind the following way:
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:
This multicast works perfectly fine and I can see packets being sent to multicast address 184.108.40.206.
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?
On what OS/Qt combo do you have the failure ?
@SGaist I am running on Windows 7 Professional Service Pack 1 (64-bit Operating System). Also tried with both Qt 5.4.1 32-bit and Qt 5.3.1 32-bit.
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:
C:\>netsh interface ip show join "Local Area Connection" Interface 11: Local Area Connection Multicast Address : 220.127.116.11 Scope : 0 References : 0 Last Reporter? : Yes Multicast Address : 18.104.22.168 Scope : 0 References : 1 Last Reporter? : Yes Multicast Address : 22.214.171.124 Scope : 0 References : 2 Last Reporter? : Yes C:\>
C:\>netsh interface ip show join "Local Area Connection" Interface 13: Local Area Connection Multicast Address : 126.96.36.199 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 ?
@SGaist No just one.
Did you check with the latest Qt 5.5 if you still experience this behavior ?