[asio] : how to monitor a tcp socket
Hello first, thanks to boost creators for these great libraries ! For my question... I have an external TCP server, to which I connect thanks to a boost.asio powered client. I am using asynchronous operations, but i have an issue, I'd like to trigger a *fast *client side deconnexion when the peer disappear (is reset for example) So far, the deconnexion occurs on an error on a asynchronous read operation, but this error happens like 10-12 seconds after the physical deconnexion occured. Is there a way to set the "time out" value ? Is there another way to detected that the peer vanished. Regards, Mathieu
I'm not sure there exists a good portable solution for this. As for windows platforms, the following article can be useful: http://tangentsoft.net/wskfaq/newbie.html (pp. 2.12, 2.13, 2.14)
I am using asynchronous operations, but i have an issue, I'd like to trigger a *fast *client side deconnexion when the peer disappear (is reset for example) So far, the deconnexion occurs on an error on a asynchronous read operation, but this error happens like 10-12 seconds after the physical deconnexion occured. Is there a way to set the "time out" value ? Is there another way to detected that the peer vanished.
I'm not sure there exists a good portable solution for this. As for windows platforms, the following article can be useful: http://tangentsoft.net/wskfaq/newbie.html (pp. 2.12, 2.13, 2.14) Thank you for this usefull url...
Igor R a écrit : the bad point is that i don't have access to the server side... so i'll have to go for a icmp ping monitoring... i don't know about icmp protocol... does anyone have an example of doing that with boost.Asio facility ? regards, Mathieu -- http://www.incub.net/
I found an alternative solution using an asynchronous timer. However, it do works only if m_ReceptionWatchDogTimer.expires_from_now(boost::posix_time::milliseconds(timeout)); with timeout >= 1000 is there a restriction for wait time less than one second ? regards, Mathieu Igor R a écrit :
I never tried it, but the latest asio supports icmp (see ip::icmp namespace).
i don't know about icmp protocol... does anyone have an example of doing that with boost.Asio facility ?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
No, I use deadline_timer with timeout values of few milliseconds and it works very well. Probably some other work that you execute on the same io_service/thread blocks the timer handler?
I found an alternative solution using an asynchronous timer. However, it do works only if
m_ReceptionWatchDogTimer.expires_from_now(boost::posix_time::milliseconds(timeout));
with timeout >= 1000
is there a restriction for wait time less than one second ?
participants (2)
-
Igor R
-
Mathieu Peyréga