Skip to contentSkip to conversation

close() sends an RST

DISCUSSION Andi Kleen 1 participant 1 message Oct 16, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw

In article <[email protected]>,

Quoted 9 lines · [email protected] 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.