Client sends RST after FIN,ACK

While doing a file transfer using secure file transfer protocol, I am seeing the behaviour as given in the below image.

enter image description here

Instead accepting packets from server, it simply sends a RST. Found a similar case. https://stackoverflow.com/questions/12320998/client-sends-rst-to-server-after-fin-ack-during-ssl-handshake

But wasn't helpful Please help.

Regards, Joemon


Solution 1:

The FIN and RST packets in your flow are not directly related. By sending FIN 10.77.137.106 is signalling that it has no more data to send. It could still receive more data from the other end of the connection. However when more data does arrive 10.77.32.60 sends RST to signal that the application is not going to be reading anymore data from the socket.

If an application wants to shut down a TCP connection cleanly without causing any RST packets being sent, it has to first use the shutdown system call to close the socket for writing while keeping it open for reading. After it has shutdown the socket for writing it will still have to read all data the other end has to send before it close the socket entirely.