
It appears to be accepting the message, but when it tries to respond the async_write() function throws an error:
ERROR: 'system:0' has occurred.
It means there's no error. Test error_code like this: if (aError) {...}.
Hmm...thought I was. :)
... and I see 'connection reset by peer' on the client side.
Your HandleWrite doesn't initiate another i/o operation, doesn't create another handler bound to shared_from_this, so the TCPConnection instance gets destroyed along with its socket.
Ah, the other version did, but this one doesn't. I misunderstood and thought HandleWrite was only bound to the error occurrence. I only want the connection to live through one send and one reply, but if I understand you correctly I have to beg it to stay alive long enough for the reply to go out? Okay, thanks for your patience, Igor! :D