close() sends an RST
A message that is not in the archive (sent off-list or not yet received): [email protected]
In article <[email protected]>,
Quoted 9 lines · [email protected] writes:
Hi,
I've following programmed: an tcp-server waits onselect()for readable and writeable socket-handles. The client writes something to the server and reads its response and then callsclose()for its connected socket. On the server siteselect()returns and indicates the socket as readable. The functionread()returns with error ECONNRESET which indicates an RST send from the client. Because the client terminated as excpected (write()->read()->close()) I assumeclose()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.