From kde-core-devel Sun Jan 27 03:42:39 2002 From: Waldo Bastian Date: Sun, 27 Jan 2002 03:42:39 +0000 To: kde-core-devel Subject: Re: How to recognize unfriendly closing of network connections? X-MARC-Message: https://marc.info/?l=kde-core-devel&m=101210308714243 On Saturday 26 January 2002 12:08 pm, Mirko Boehm wrote: > Hi guys, > > this situation must have been adressed earlier in kio, konqueror, kmail > and whatsoever, but I did not find any hint. > > When a network connection is closed in a controlled manner, I can take > care of closing the other end by means of the protocol, for example. Bu= t > what if the program holding the connection exits because of a seg fault= , > for example? When I send data to the connection, I will receive a > SIG_PIPE. But I would like to receive a notice as soon as the program i= s > killed. If your select() call returns telling you that there is something readabl= e (or=20 a QSocketNotifier sends you a signal) and a subsequent read() call return= s 0=20 bytes, the socket has been closed by the remote end. You can still get a=20 SIG_PIPE of course if the connection closes just before you try to send=20 something. Cheers, Waldo --=20 bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com