CppServer  1.0.4.0
C++ Server Library
tcp_resolver.cpp
Go to the documentation of this file.
1 
10 
11 namespace CppServer {
12 namespace Asio {
13 
14 TCPResolver::TCPResolver(const std::shared_ptr<Service>& service)
15  : _service(service),
16  _io_service(_service->GetAsioService()),
17  _strand(*_io_service),
18  _strand_required(_service->IsStrandRequired()),
19  _resolver(*_io_service)
20 {
21  assert((service != nullptr) && "Asio service is invalid!");
22  if (service == nullptr)
23  throw CppCommon::ArgumentException("Asio service is invalid!");
24 }
25 
26 } // namespace Asio
27 } // namespace CppServer
std::shared_ptr< Service > & service() noexcept
Get the Asio service.
Definition: tcp_resolver.h:39
TCPResolver(const std::shared_ptr< Service > &service)
Initialize resolver with a given Asio service.
C++ Server project definitions.
Definition: asio.h:56
TCP resolver definition.