size - C++: BOOST-ASIO async_read_some does not return number of packet bytes? -
i tried using following code read number of available bytes in socket (on server side) , variable packet_bytes
not anything. expecting number of bytes used packet read packet_bytes
doesn't seem work.
std::size_t packet_bytes = 0; socket_.async_read_some(boost::asio::buffer(data_, max_length), boost::bind(&session::handle_read, this, boost::asio::placeholders::error, packet_bytes));
i tried std::size_t packet_bytes = socket_.available();
, didn't return either. entire code.
the packet_bytes
argument in bind
call should placeholder:
socket_.async_read_some(boost::asio::buffer(data_, max_length), boost::bind(&session::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
then in handler function argument amount of bytes read.
see e.g. example in manual.
Comments
Post a Comment