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