boost::asio::buffer does not copy your local string, so the string
vanishes before the actual async. write takes place.
By the way, if you wish to send the whole string, you don't have to
pass a size: boost::asio::buffer(replyString) - but the string must be
alive until the completion handler is called.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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.