4 ms·
> Generally your client should close the connection when it's done. Server-side close should mostly be related to idle timeouts. To achieve that, the client mu
by est 6y ago
> Generally your client should close the connection when it's done. Server-side close should mostly be related to idle timeouts.
To achieve that, the client must have an extra thread listening for the close event, or a periodic check to purge the dead TCP connections.
But there's a gotcha, some TCP connections without KEEPALIVE just timeout naturally, and FIN packets may never reach the client, you only know the connections is dead when you initiate a real request. This is when most connection pool fail apart.