Set SO_KEEPALIVE on the client socket, not on the server one