Subject: Re: Detecting broken connection

Re: Detecting broken connection

From: Daniel Stenberg <>
Date: Wed, 14 Jul 2010 17:32:54 +0200 (CEST)

On Wed, 14 Jul 2010, Alexander Lamaison wrote:

>> If you _know_ the sockets should be silent (ie there's no TCP traffic on
>> them) you can select() to see if they've become readable, and if they are
>> in spite of you knowing they shouldn't be, reading 0 bytes from them
>> indicates they're disconnected.
> Do I need to actually do the read?

Not necessarily no. If you are sure they should be idle, you can skip the

> What would a >0 return value indicate?

That data came over the connection anyway!

> Presumably that I'd gotten my logic wrong and the socket wasn't meant to be
> silent


Received on 2010-07-14