boost::asio::async_read_until(m_socket, m_headerBuffer,
"\r\n\r\n", boost::bind(&CAXISParser::read_header, this, boost::asio::placeholders::error,boost::asio::placeholders::bytes_transferred));, where m_headerBuffer is asio::streambuf object. During header parsing i can get video sample length. Now I want to read all video data in one function call, for example:
boost::asio::async_read(m_socket, boost::asio::buffer(pSample->GetBody(), m_currentSampleLength),boost::bind(&CAXISParser::read_body,
this, pSample, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));, where pSample is object with buffer for video data. There is problem that async_read_until captures some data from video data, and that call's behavior is incorrect. How can i fight that problem? For example, how can i figure out number of bytes left in streambuf and copy them to my buffer, and then read rest with async_read? I'm will very appreciate for any advices.
Thanks in advance, Vadim