[Qt-interest] Major bug in QAbstractSocket's method waitForReadyRead()

Srdjan Todorovic todorovic.s at googlemail.com
Wed Jun 24 23:36:00 CEST 2009


Hi,

2009/6/24 Patric <userqt at gmail.com>:

> I have a sniffer program, more specifically Wireshark. There I can see my
> requests and my responses. The problem is, that according to that code up
> there it should wait 5 seconds for the new package. But there are situations
> when it don't wait, it just returns false. I'm talking for the
> waitForReadyRead method. So here are the situations :

Do you also run Wireshark with the cable disconnected? What does it
show in that situation?

> 2. My cable IS NOT plugged. The first setRequest is unsuccessful, so it
> waits 5 seconds and continues with the second. But here ! it don't wait 5
> seconds, it immediately returns FALSE. Which I think is not correct.

All I can think of right now is:

http://doc.trolltech.com/4.5/qabstractsocket.html#waitForReadyRead

"The function returns true if the readyRead() signal is emitted and
there is data available for reading; otherwise it returns false (if an
error occurred or the operation timed out)."

Perhaps the readyRead() signal was not emitted?

"If an error occured" could be:

http://doc.trolltech.com/4.5/qabstractsocket.html#SocketError-enum

Specifically:
QAbstractSocket::NetworkError	7	An error occurred with the network
(e.g., the network cable was accidentally plugged out).

Which could explain what you are observing.

Good luck,
Srdjan



More information about the Qt-interest-old mailing list