Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio::read_until reads too much!
From: Rob Currey (avalonforest_at_[hidden])
Date: 2009-02-21 16:37:18


From: "Igor R" <boost.lists_at_[hidden]>
Subject: Re: boost::asio::read_until reads too much!

>>> Suggestions?
>
> For the both readings use the same buffer - either streambuf or any other.

Yea, I figured that might be the case, but also means I can't use
boost::asio::read_until for this purpose.

I mistakenly thought that:
boost::asio::streambuf b;
boost::asio::read_until(socket, b, "\r\n");
would actually STOP consuming from the socket when it got the "\r\n" ...

The documentation seems to imply this:
"This function is used to read data into the specified streambuf *until* the
streambuf's get area contains the specified delimiter."
(emphasis on *until* mine)

In reality it will read more than that into the streambuf ...

I'm reworking my implementation to have my own buffer (not streambuf based)
and then implement my own "read_until" ...


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net