Add timeout management on socket.