Set timeouts on the socket so we don't hang forever if something bad happens.
Don't set keepalive if it's not requested.