How do I cleanly reconnect a boost::socket following a disconnect?
问题 My client application uses a boost::asio::ip::tcp::socket to connect to a remote server. If the app loses connection to this server (e.g. due to the server crashing or being shutdown) I would like it to attempt a re-connect at regular intervals until it succeeds. What do I need to do on the client-side to cleanly handle a disconnect, tidy up and then repeatedly attempt reconnects? Currently the interesting bits of my code look something like this. I connect like this: bool MyClient::myconnect