I use a small buffer (e.g. 128 bytes) and I want to use "async_read_until" with big incoming messages on the TCP connection (discarding all but last 128 bytes prior to the delimiter).
How can this be done? The ASIO docs are not very clear what happens when the provided buffer is not big enough.
Here is my code for the read initiazation
typedef boost::shared_ptr<boost::asio::streambuf >streambuf_ptr; streambuf_ptr inBuf(new boost::asio::streambuf (128)); boost::asio::async_read_until(*sock, *inBuf, "\r\n\r\n", boost::bind(my_read_handler, sock, inBuf, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));