Both Linux and Windows support TCP keep-alive
packets. They can be activated and configured with (system-dependent) setsockopt
calls, see e.g. this article for the Linux case. When using boost::asio
there appears to be support for keep-alive messages, see the current documentation. However that page only covers activating it. In several new responses to an older post it was pointed out that Boost has recently added the means to configure timeouts on operations (which obviates the need for setsockopt
and #ifdef
code-branches for different systems). However, a recent response still suggests calls on the native sockets.
My question is: How can I configure the time interval and timeouts of keep-alive packets using boost::asio
?