[QtNetwork] How to identify dead connection
-
What do you use? QNAM or *Socket classes?
-
Look at
bq. void QAbstractSocket::stateChanged ( QAbstractSocket::SocketState socketState ) [signal]
-
It should work. As additional check you can add timeouts to your read/write waits (if you use them) and check after it for failure.
-
The "right" way is to implement your own keepalive mechanism for your protocol (or use reasonable defaults). Otherwise you could try enabling the TCP keepalive mechanism, or use QtMobility's QSystemNetworkInfo to get notifications when the status of the networking changes, as discussed in this thread: http://developer.qt.nokia.com/forums/viewthread/2420
-
It does work, but it waits for a usually rather long time out.