Reason for not properly closed socket?
Posted
by gc
on Stack Overflow
See other posts from Stack Overflow
or by gc
Published on 2010-04-11T14:19:15Z
Indexed on
2010/04/11
14:23 UTC
Read the original article
Hit count: 236
Here is what I am trying to do: The server sends message to connected clients when new messages are available. The client, on the other hand, when connected, tries to send a message to the server using send() and then receive message using recv(), right after that, the client calls close() to close the connection.
Sometimes, after the client finishes, the server tries to receive message from client will result in a 104 - "connection reset by peer" error. When this happens, Wireshark reveals that the last two segments sent by the client is:
1. an ACK acknowledging the receipt of the message sent by the server
2. a RST/ACK
No FIN is sent by the client.
Why is this happening and how can I close the socket "properly" at the client?
© Stack Overflow or respective owner