Add socket timeouts.

Avoid closing timed-out connections.