Add timeout to connect(), send() and recv().