[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: How to recognize unfriendly closing of network connections?
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-01-27 3:42:39
[Download RAW message or body]

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. But
> 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 is
> killed.

If your select() call returns telling you that there is something readable (or 
a QSocketNotifier sends you a signal) and a subsequent read() call returns 0 
bytes, the socket has been closed by the remote end. You can still get a 
SIG_PIPE of course if the connection closes just before you try to send 
something.

Cheers,
Waldo
-- 
bastian@kde.org  |   SuSE Labs KDE Developer  |  bastian@suse.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic