Re: 2.2: data loss after socket close

Arjan van de Ven (arjan@fenrus.demon.nl)
Sat, 7 Aug 1999 17:20:32 +0200 (CEST)


In-Reply-To: <37AC2B2B.6861AA68@actis.de>

In article <37AC2B2B.6861AA68@actis.de> you wrote:
> Hello,

> after porting an application to Linux i have found a bug
> in 2.2's socket close() code for TCP connections (LINUX 2.0 is OK):

> The sender writes some bytes and closes the socket.
> The receiver waits in select() until there is something
> to read, calls recv() and gets ECONNRESET ("Connection reset by peer")
> instead of the last bytes written by the sender.

I expirienced something similar, and the cause (in my case) was that at the
time of the close(), some data was in the _RECEIVE_ queue. DaveM explained
me that closing a socket in this situation is an error and the socket is
closed as such (ie no flush).

In other words: you have to make _sure_ there is no incomming data pending.

Greetings,
Arjan van de Ven

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/