I have both TCP client and TCP server run on RHEL 5.3 on different machines.
I'm killing server and FIN is sent to the client. ACK is sent back by client's OS back immediately.
Client discovers the close (by read() returning zero) and perfroms close only after 90 sec. At this sta开发者_开发问答ge I verified netstat on both sides and it's as expected (FIN_WAIT_2 on server and CLOSE_WAIT on client).
Due client close() after 90 sec, client's OS sends FIN to server, but in response we receive RST from server and not ACK as expected.
I also saw several times that due to "delayed" close(), client's OS sent RST instead of FIN.
Please note, that in both cases there's no pending reading packets on both sides and SO_LINGER option is not activated.
Any ideas?
The RST
indicates that some "data" was lost. In this case, the "data" is the information that the client side closed the socket cleanly - the FIN
from the client was not reported to the server side application (because it had been killed).
In other words, the RST
tells the client that the server never saw end-of-stream from the client.
精彩评论