Re: socket write(2) after remote shutdown(2) problem ?

Stelian Pop (stelian.pop@fr.alcove.com)
Fri, 5 Apr 2002 14:23:51 +0200


On Fri, Apr 05, 2002 at 04:04:51AM -0800, David S. Miller wrote:

> From: Stelian Pop <stelian.pop@fr.alcove.com>
> Date: Fri, 5 Apr 2002 14:00:55 +0200
>
> As you can see, read() doesn't return any error, just 0 to
> indicate end-of-file (seems correct interpretation of remote
> shutdown here), but it doesn't report any error from the
> precedent write... Bug ?
>
> Race, wait a bit, the reset will arrive.

30 seconds later the read still returns 0...

> Look, your app is buggy, PERIOD. Once you start to write to a closed
> socket, sorry the phase of the moon decides what happens to you. Most
> of the time you'll be lucky and see an error.

The socket is not closed on the client side. I expect the kernel to
signal me an error (reset of read/write return code, whatever) if
the connection is closed by the _server_ (with close OR shutdown).

Stelian.

-- 
Stelian Pop <stelian.pop@fr.alcove.com>
Alcove - http://www.alcove.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/