|
Boost Users : |
Subject: Re: [Boost-users] Boost.Asio -- combining sync read with async read (Igor R)
From: Sameer Parekh (sameer_at_[hidden])
Date: 2009-10-14 12:00:15
>
> It's ok to use both sync. and async. calls, but you should not call
> boost::asio::async_read_until() and/or boost::asio::async_read() until
> previous read is complete (for the same socket/buffer). Besides, pay
> attention that reading "until" might read more data than you expect.
Thanks Igor, I'm a bit confused here though.. how do I know if the
previous read is complete? I figured when async_read_until() calls the
handler, the read was complete and everything read was sitting in the
buffer? Do you mean to say that if the client receives two lines, then
async_read_until() will read both lines but then put only the first
line in the buffer? Then I can't call async_read_until() again because
there is still another pending call to the handler that will process
the second line? So how do I know at the end of the handler whether or
not to call async_read_until() ?
thanks!
-Sameer
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