template<
typename TCPStreamHandler, std::size_t Size = 64 * 1024UL>
class net::service::async_tcp_service< TCPStreamHandler, Size >
A ServiceLike Async TCP Service.
- Template Parameters
-
| StreamHandler | The StreamHandler type that derives from async_tcp_service. |
| Size | The socket read buffer size. (Default 64KiB). |
- Note
- The default constructor of async_tcp_service is protected so async_tcp_service can't be constructed without a stream handler (which would be UB).
async_tcp_service is a CRTP base class compliant with the ServiceLike concept. It must be used with an inheriting CRTP specialization that defines what the service should do with bytes it reads off the wire. StreamHandler must define an operator() overload that eventually calls reader to restart the read loop. It also optionally specifies an initialize member that can be used to configure the service socket, and a stop member that can be used to gracefully drain and stop TCP connections upon receiving a terminate signal. See noop_service below for an example of how to specialize async_tcp_service.
{
template <typename T>
{}
{
return {};
}
auto stop() -> void {}
std::shared_ptr<read_context>
rctx,
std::span<const std::byte>
buf) ->
void
{
}
};
A ServiceLike Async TCP Service.
Definition async_tcp_service.hpp:73
io::socket::socket_dialog< multiplexer_type > socket_dialog
The socket dialog type.
Definition async_tcp_service.hpp:86
io::socket::socket_address< T > socket_address
Templated socket address type.
Definition async_tcp_service.hpp:76
io::socket::socket_handle socket_handle
The socket handle type.
Definition async_tcp_service.hpp:84
service::async_context async_context
The async context type.
Definition async_tcp_service.hpp:78