
9 Apr
2010
9 Apr
'10
1:46 p.m.
I went through the documentation of boost::asio::read_until() function. It says that if some data left in the stream after a read_until() operation, it will be available in the next "read" opration from the stream. Is there any way to "flush" (simply remove) the unwanted data from the stream so as to receive entirely new data than the old "useless" data left in the stream?
Any read operation puts the data in the buffer you supply to it, so you can do anything you wish with that data, including throwing it away. But what could be the purpose of such a step? If you get some data from your peer, it usually has some meaning, doesn't it?