
On Wed, Jul 11, 2012 at 5:10 PM, Nat Linden
On Wed, Jul 11, 2012 at 10:44 AM, Ovanes Markarian
wrote: The commands are parsed by Spirit.QI. My idea was to use a tcp::iostream asynchronously so that I just pass the begin iterator to the output stream to QI and receive parsed data. If there is no output from the server the iterator should block and wait for it.
When you want code that appears to block, but is actually driven by asynchronous I/O, that's a use case for Boost.Coroutine. Interestingly, the new Coroutine is supposed to be reviewed very soon: http://olk.bplaced.net/boost-coroutine.zip
I know Oliver will be very glad for your feedback.
Nat thanks for the quick reply... But what happens with the tcp::iostream if another thread starts to read from it after a connection was open, but no response is there? Would not it block? Is it even safe to write requests to the tcp::iostream from one thread and read it from the other? As I stated before, I would like to solve the issue with ASIO only. I might be able to review coroutine lib, but I don't think this an option for us in this project. Thanks, Ovanes