I\'m writing some reconnect logic to periodically attempt to establish a connection to a remote endpoint which went down. Essentially, the code looks like this:
One library worth checkout out is Sarge, which automatically performs retries according to a defined plan.