|
Boost Users : |
Subject: Re: [Boost-users] Using boost::asio::async_write to stream out data
From: Michael Caisse (boost_at_[hidden])
Date: 2009-07-17 15:13:45
Matheus Araújo Aguiar wrote:
>
>
>
> Then in my handle_write method should I check the queue, if at
> least one
> buffer is in the queue then I should start a new async_write?
>
>
>
> Exactly.
>
>
> I disagree. I don't have much technical knowledge about how it is done
> on the O.S layer, but for what i've experienced, you can call several
> async_write, one after another, without having to wait for the
> completion of any of the operations. If you call async_write from
> diferent threads, then data could be interleaved. And with TCP you may
> get data concatenated, but it has to do with the protocol.
>
> Maybe i'm wrong, but for now that's what i think. A third (and fourth,
> fifth and so on) opinion would be nice.
Matheus -
This is true if you have only called io_sevice::run from one thread. If you
have multiple threads processing events you will have issues because each
thread may be writing to the socket at the same time. This would not be a TCP
layer issue... it would be an application problem.
Best Regards -
-- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com
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