Boost logo

Boost Users :

Subject: Re: [Boost-users] asio flushing a buffer
From: Igor R (boost.lists_at_[hidden])
Date: 2010-04-09 09:46:56


> 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?


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