|
Boost Users : |
Subject: Re: [Boost-users] [asio] continuous reads into streambuf
From: Raymond Burkholder (ray_at_[hidden])
Date: 2018-05-25 12:49:45
On 05/25/2018 06:40 AM, Stephan Menzel via Boost-users wrote:
> On Fri, May 25, 2018 at 1:44 AM, Gavin Lambert via Boost-users
> Looking at all my past failures with similar streambuf based approaches
> I think it may very well be that I always had this mix of the two
> operations. This should be prominently placed in the asio docs.
Would it be possible for you to post a modified snippet of your code
showing your new way of doing things?
>
> So, for anybody who comes across this, the key elements are:
>
> Â * You can re-use the same streambuf for many reads and writes as long
> as you DO NOT MIX async_read() and async_read_until()
> Â * streambuf.size() gives you the data available for extraction
> Â * when extracting data, either read from streambuf.data() and then
> consume() the data you have read or use a stream that does the consume
> for you
> Â * when writing data into it either write into buffers given by
> prepare() and then call commit() or use a stream that does the commit
> for you--
Raymond Burkholder
ray_at_[hidden]
https://blog.raymond.burkholder.net
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
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