21 Jul
2009
21 Jul
'09
8:28 p.m.
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.