Re: [asio-users] basic_stream_socket::async_connect -- non-blockingconnect vs async connect
Brought to you by:
chris_kohlhoff
|
From: Christopher K. <ch...@ko...> - 2007-09-21 11:48:14
|
On Thu, 20 Sep 2007 17:23:07 +0100, "Chauhan, Vikas" <Vik...@an...> said: > Hi Chris, > > Thanks for your reply. I was not sure that blocking connect and > async_connect would take the same time to connect(or fail to connect). > This would mean that I cannot reconnect in less that 21 seconds (as > typically this is the delay, when peer server is not alive). > > However, I want my client socket to reconnect to server socket in less > that 5 seconds after server is alive. Do you think I can do that using > boost asio sockets? You probably want to combine your async_connect with an async_wait on a deadline_timer. If the timer expires before the connect completes, you should close the socket and try again. Cheers, Chris |