I\'m using this code for reading
socket_.async_read_some(boost::asio::buffer(data_, max_length),
boost::bind(&session::handle_read, this,
You need to get a mutable_buffers_type from the streambuf
to use as your first parameter to async_read_some
.
boost::asio::streambuf streamBuffer;
boost::asio::streambuf::mutable_buffers_type mutableBuffer =
streamBuffer.prepare(max_length);
socket_.async_read_some(boost::asio::buffer(mutableBuffer),
boost::bind(&session::handle_read, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
See the asio
documentation here and here for more info.