Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.9.6, 5.11.1
-
None
-
Windows 10
QtCreator 4.6.2
Qt 5.9
Description
I made a program that talks with another throuth QUdpSocket.
The first uses bind() and the second uses connectToService(). The QUdpSocket is managed by a UdpDevice class.
Both connect the readyRead signal to call a slot (in another class) that calls UdpDevice::readAll() conditionned by hasPendingDatagram() (cf. joined source files).
The issue is : randomly, the readyRead signal is emited twice for one single datagram. So, after the datagram is processed, the second signal call again the reading slot. The slot does nothing because hasPendingDatagram() returns false. But the framework consider that like an unread datagram and stops to fire readyReady for the next incomming datagrams, as said in the documentation : "Note: An incoming datagram should be read when you receive the readyRead() signal, otherwise this signal will not be emitted for the next datagram."
I have this problem when I try to upgrade to Qt 9.5.6 or Qt 11.1, but all works fine with Qt 5.5.1
EDIT : I dont have any problem like this on Ubuntu 18.04 with Qt 5.9.6
EDIT 2 : I joined a minimal test project. To test, run two instances of the project and, give a negative port number to bind the server side and the same positive port number to the client side. Then, send a command from the client side.
Here the debug output for the server side :
Udp state changed : QAbstractSocket::BoundState ReadyRead emited for 2777 : true Read from 2777 Datagram : "testcommand" ReadyRead emited for 2777 : false Read from 2777