I have an application that uses non-blocking Boost ASIO socket to connect to a remote TCP server.
I wanted to set a timeout on TCP connect and I see the only way to do it is use an application
level timer.
However this is not a reliable way as this is prone to issues:
- In a CPU starved scenario, the timer might start way before the actual SYN packet is sent.
I want to rely on OS’s TCP timers to see if actually the connect timeout at TCP level.
I could not use non blocking sockets.
Is there a way to do it reliably in asio?
I tried looking into the official examples
Saurav Prakash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1