I want to use boost asio to create a tcp client, and async_connect to a server every ten second until successful. Do you give me an example? Thanks.
Asked
Active
Viewed 225 times
1 Answers
0
You can use boost::asio::deadline_timer to measure time until the next connection attempt.
- Call async_connect, pass handler, e.g.
handle_connect
- If
handle_connect
states that any error has occured, use a deadline_timer to measure 10 seconds before the next connection attempt.

Alexander Lapenkov
- 585
- 2
- 9