[Qt-interest] QTcpSocket suddenly disconnects

Thiago Macieira thiago.macieira at trolltech.com
Thu Jul 30 08:34:46 CEST 2009


Joshua Senecal wrote:
>Client: sending client greeting
>Client: received server greeting
>Client: sending local UDP port  
>Client: received remote UDP port  
>Client: Sending SOCKET_ALIVE over UDP
>Client: received SOCKET_ALIVE over UDP
>Client socket connected.
>State: Closing.
>State: Unconnected.
>
>
>The connected server socket reports an error: the client disconnected.
>
>Any suggestions as to what may be causing this? It's almost like there's
>a phantom close() or similar floating around somewhere. I've checked the
>code and I didn't see any out-of-place calls that would close the
>socket.

Hi Joshua

I suggest capturing the network traffic to see which side initiated the 
connection closing (which one sent the FIN packet). If it turns out that 
the client is disconnecting, I suggest running strace (or dtrace or truss, 
depending on what system you have) on the client to confirm that it did 
call close(2).

Once you confirm that it did call close, put a breakpoint in 
QNativeSocketEngine::nativeClose to find out why it did so. The backtrace 
from that point will explain what caused the disconnect.

It may be a Qt bug.
-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090730/848620e6/attachment.bin 


More information about the Qt-interest-old mailing list