I\'m using Boost.Asio for a server application that I\'m writing.
async_send
requires the caller to keep ownership of the data that is being sent until
Krit explained the data corruption, so I'll give you an implementation suggestion instead.
I would suggest that you use a separate vector for each send operation that is currently being executed. You probably don't want one for each connection since you might want to send several messages on the same connection sequentially without waiting for completion of the previous ones.