PDA

View Full Version : No error from QTNetwork if network goes off



Ganesh
26th November 2008, 13:58
I have submitted the http get request by calling QNetworkAccessManager::get.
I have connected to the QNetworkReply signals QNetworkReply::error and
QNetworkReply::finished.
While the page is loading, I have removed the network cable off,
neither QNetworkReply::error signal is emitted nor error code is sent to QNetworkReply::finished signal.

Please guide if anybody has encountered the same and have a fix.

maverick_pol
26th November 2008, 16:16
Hi,

1) I can test is by myself if you provide the source code.
2) If you provide the basic implementation we can look for problems.

Kacper

faldzip
26th November 2008, 20:05
Hi!

I made some project in Qt which had to react on unpluging cable and what I noticed is that it is not OS independent. On Windows you get that windows cloud with "Network cable unplugged... " or something and you can get some event in application (because OS can provide it). I tested my application on Kubuntu and when i unplugged network cable there was no reaction. I used only tcp socket and server, so I don't know how much it's connected with your classes but maybe it can help you.

wysota
26th November 2008, 20:18
Basically there is no reliable way of determining if the network is down. Pulling out a cable from the socket doesn't yet mean a particular connection has been broken. What if it is rerouted using a different interface?

Ganesh
27th November 2008, 13:36
Yes exactly. I am also using Ubuntu and the problem exists.

Ganesh
27th November 2008, 13:37
I am not using any other interfaces. There is only one interface exist.

wysota
27th November 2008, 21:29
What if the application is deployed in a different environment? With bluetooth network for instance? What if the signal comes back after a second? A TCP connection will still be valid, right? What if the wire is cut not between your computer and the next network device but further away - you won't notice that yet no more packets will reach their destinations... There is simply no reliable way to determine if a connection is broken or if it is simply delayed. The only thing we have is timers. You may consider a connection broken after some defined amount of time.