> What do you suggest to add to a thread safe queue?
> The data that I have recieved from the client?
Yes.
Either that or the processing logic encapsulated in a command object.
http://en.wikipedia.org/wiki/Command_pattern
> Also at what point could I do the data processing in this whole process?
>And I suppose I also send the data back after it is finished processing
> but is that actually possible when I'm already waiting with async_read() for more to come?
In the completion handler for the async_read()
a. Add the pending task to the queue.
b. Check if more data has arrived with socket_base::bytes_readable()
- If there is more data to be read, or the queue is empty, issue another read request
- If not, remove and process one pending request from the queue, issue an async write with the result; go back to
b