Added timeout for connection attempt.