Tiny helper to attempt to connect to sockets multiple times.