Handle completion of a connect operation.
| 39 | |
| 40 | /// Handle completion of a connect operation. |
| 41 | void handle_connect(const boost::system::error_code& e) |
| 42 | { |
| 43 | if (!e) |
| 44 | { |
| 45 | // Successfully established connection. Start operation to read the list |
| 46 | // of stocks. The connection::async_read() function will automatically |
| 47 | // decode the data that is read from the underlying socket. |
| 48 | connection_.async_read(stocks_, |
| 49 | std::bind(&client::handle_read, this, |
| 50 | boost::asio::placeholders::error)); |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | // An error occurred. Log it and return. Since we are not starting a new |
| 55 | // operation the io_context will run out of work to do and the client will |
| 56 | // exit. |
| 57 | std::cerr << e.message() << std::endl; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /// Handle completion of a read operation. |
| 62 | void handle_read(const boost::system::error_code& e) |
nothing calls this directly
no test coverage detected