Reputation: 2734
According to the boost::asio::read_until
documentation:
After a successful read_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read_until operation to examine.
I do not understand why this happens.
Is it because, in the TCP protocol, if you do not read all the available characters, you can lose them?
Upvotes: 0
Views: 243
Reputation: 69892
Because if it read only until the character you want, it would have to perform one one-character read at a time. This would be horribly inefficient.
Upvotes: 1