Set socket options to keepalive and nodelay