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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -