| 53 | } |
| 54 | |
| 55 | std::size_t receive(const boost::asio::mutable_buffer& buffer, |
| 56 | std::chrono::steady_clock::duration timeout, |
| 57 | boost::system::error_code& error) |
| 58 | { |
| 59 | // Start the asynchronous operation. The handle_receive function used as a |
| 60 | // callback will update the error and length variables. |
| 61 | std::size_t length = 0; |
| 62 | socket_.async_receive(boost::asio::buffer(buffer), |
| 63 | std::bind(&client::handle_receive, _1, _2, &error, &length)); |
| 64 | |
| 65 | // Run the operation until it completes, or until the timeout. |
| 66 | run(timeout); |
| 67 | |
| 68 | return length; |
| 69 | } |
| 70 | |
| 71 | private: |
| 72 | void run(std::chrono::steady_clock::duration timeout) |
no test coverage detected