19 Jul
2009
19 Jul
'09
2:33 p.m.
Yes, I see, but making buffers a member of TcpConnection class doesn't resolve the problem.
By saying "buffers" you mean the vector that you pass to async_write()? It's not necessary to make this object the member, as it's passed by value anyway. What I mean is that the *data* you send must outlive the whole async. write process, and your data resides in outboundData & outboundHeader local std::string's. Asio::buffer wrapper is just an adaper, it doesn't copy any underlying data.