Add timeout for sockets and connections.