Add timeout to tcp connection.