Set SO_KEEPALIVE on TCP sockets