Boost logo

Boost Users :

Subject: Re: [Boost-users] usage of boost::asio::async_write and boost::asio::buffer
From: Igor R (boost.lists_at_[hidden])
Date: 2009-07-21 16:28:00


> I tried to use the same string as buffer for both async_read_some and async_write

Who will allocate the buffer for the read operation? socket's
async_read_some() doesn't know to do this alone.

> I guess the string can not be treated as a mutable buffer, so maybe I should
> keep the original char * buffer for async_read_some and use the string only
> for outputting with async_write. Is that right?
> (or any other recommendation?)

Why wouldn't you use asio::streambuf? You've a set of functions that
async.read/write from/to it, and it grows automatically. You can see
relevant examples in asio docs.


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