12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef __ASIO2_TCP_KEEPALIVE_COMPONENT_HPP__
- #define __ASIO2_TCP_KEEPALIVE_COMPONENT_HPP__
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- #pragma once
- #endif
- #include <asio2/base/detail/keepalive_options.hpp>
- namespace asio2::detail
- {
- template<class derived_t, class args_t>
- class tcp_keepalive_cp
- {
- public:
- tcp_keepalive_cp() noexcept {}
- ~tcp_keepalive_cp() noexcept {}
-
- bool set_keep_alive_options(
- bool onoff = true,
- unsigned int idle = 60,
- unsigned int interval = 3,
- unsigned int count = 3
- ) noexcept
- {
- derived_t& derive = static_cast<derived_t&>(*this);
- return detail::set_keepalive_options(derive.socket(), onoff, idle, interval, count);
- }
- };
- }
- #endif
|