Subj : Re: Closing tcp socket connections To : comp.programming From : Martin Hierholzer Date : Mon Aug 15 2005 11:30 am Clint Moulds wrote: > Are you closing the connections on the client side? Calling close() on > the server will free the descriptor, but it is up to the TCP stack to > go through its state machine to actually close the connection. Your > code is probably getting into one of the half-closed states in TCP, > hence the TIME_WAIT connections. Yes, I do close the socket on the client side right in the same way: i = shutdown(SockFd, SHUT_RDWR); if(i != 0) { // Some error handling } i = close(SockFd); if(i != 0) { // Some error handling } No error occurs here. All socket IO should be finished at this point. btw: Would it be a problem, if there is unread data on one of the sides? .