try to connect until success