I have developed a client server application which use TCP sockets for communication. The client application is a MFC windows form using CSocket and the server application is a c++ executable on unix using socket. The problem that I have is on closing the connection. For some reason connection exist after shutdown() and close() from both applications with state FIN_WAIT2 for the client and CLOSE_WAIT for the server. The client closes first. If anyone knows how to clear this connection I'd be thankful.