Hiya,

 

Does anyone know a way of reading from an asio::streambuf without removing the bytes?

 

I’m using async_read() to get (possibly several) TCP messages, where each message is prefixed with a size field. If I can read the size without removing it from the buffer, I can check whether all the data was received and leave the size intact for the next handler if not.

 

Any advice appreciated.

 

Cheers,

James