Constructor starts the asynchronous connect operation.
| 24 | public: |
| 25 | /// Constructor starts the asynchronous connect operation. |
| 26 | client(boost::asio::io_context& io_context, |
| 27 | const std::string& host, const std::string& service) |
| 28 | : connection_(io_context.get_executor()) |
| 29 | { |
| 30 | // Resolve the host name into a sequence of endpoints. |
| 31 | boost::asio::ip::tcp::resolver resolver(io_context); |
| 32 | auto endpoints = resolver.resolve(host, service); |
| 33 | |
| 34 | // Start an asynchronous connect operation. |
| 35 | boost::asio::async_connect(connection_.socket(), endpoints, |
| 36 | std::bind(&client::handle_connect, this, |
| 37 | boost::asio::placeholders::error)); |
| 38 | } |
| 39 | |
| 40 | /// Handle completion of a connect operation. |
| 41 | void handle_connect(const boost::system::error_code& e) |
nothing calls this directly
no test coverage detected