2 / Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 [section:ReadHandler Read handler requirements]
10 A read handler must meet the requirements for a [link
11 boost_asio.reference.Handler handler]. A value `h` of a read handler class
12 should work correctly in the expression `h(ec, s)`, where `ec` is an lvalue of
13 type `const error_code` and `s` is an lvalue of type `const size_t`.
17 A free function as a read handler:
20 const boost::system::error_code& ec,
21 std::size_t bytes_transferred)
26 A read handler function object:
32 const boost::system::error_code& ec,
33 std::size_t bytes_transferred)
40 A non-static class member function adapted to a read handler using `bind()`:
42 void my_class::read_handler(
43 const boost::system::error_code& ec,
44 std::size_t bytes_transferred)
49 socket.async_read(...,
50 boost::bind(&my_class::read_handler,
51 this, boost::asio::placeholders::error,
52 boost::asio::placeholders::bytes_transferred));