Re: close() sends an RST

Andi Kleen (ak@muc.de)
16 Oct 2001 23:59:09 +0200


In article <1003222233.3bcbf4d957274@webmail.t-online.de>,
oliver.kowalke@t-online.de writes:
> Hi,
> I've following programmed: an tcp-server waits on select() for readable
> and writeable socket-handles. The client writes something to the server
> and reads its response and then calls close() for its connected socket.
> On the server site select() returns and indicates the socket as
> readable. The function read() returns with error ECONNRESET which
> indicates an RST send from the client. Because the client terminated as
> excpected (write()->read()->close()) I assume close() has send an RST
> instead of an FIN?! Is this correct or what happend?

close will send an RST if there is still unread data on the local side.
This is to signal the other end that there has been data lost.
You probably need to fix your server to read all data upto eof.

-Andi

p.s.: this is kind of a FAQ; it's probably already documented somewhere.
-
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/