Added randomization to the checking for success of outgoing connections and the arrival of incoming connections