Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Asio -- combining sync read with async read
From: Sameer Parekh (sameer_at_[hidden])
Date: 2009-10-14 14:56:50


>
> No, it will read anything available in the socket and put it in the
> buffer.
> It can be 1 line, 2 lines or 3.25 lines. What I mean is that you
> have to be
> aware of the fact that the buffer might contain more data than you
> "requested" from read_until.

Aha, thanks Igor. So my handler needs to be able to deal with a buffer
that contains more than one line. That's not so bad, I can just run
the processing code for each line until the buffer is empty, that
should be fine.

However, what concerns me is if the handler receives a buffer that has
just 2.5 lines in it. All the messages from the server are going to be
one line long. So if the server sends three messages in succession but
say there is some network hiccup partway through the 3rd line, then my
client will only receive 2.5 lines, and the handler will get called
with the partial line? Then the handler has to cache the partial line
so that when the rest of the line comes through it can paste them
together again? That seems hard...

thanks,
-s


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