|
Boost Users : |
Subject: Re: [Boost-users] [asio] asynchronous reading/writing to the tcp stream
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-07-11 12:05:38
On Wed, Jul 11, 2012 at 5:10 PM, Nat Linden <nat_at_[hidden]> wrote:
> On Wed, Jul 11, 2012 at 10:44 AM, Ovanes Markarian
> <om_boost_at_[hidden]> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net