Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-11-18 07:12:02

Hi Dick,

--- BRIDGES Dick <Dick.Bridges_at_[hidden]> wrote:
> <use_case truncated="yes">
> I have done some message passing over TCP where the message headers
> can
> be fairly elaborate and there is considerable variation in message
> size
> (e.g., DIAMETER RFC 3588). Every time some traffic arrives, one of
> two
> questions get asked: "Did we get enough of the header to determine
> the
> message length?" or "Given we know the length, do we have the entire
> message yet?". It would be nice to move this code (and all of the
> associated anomaly handling) out of the application and *down* into
> the
> library. read_at_least_n would certainly be handy.
> </use_case>
> As a generalization, I'd say that those two questions get asked
> almost
> anytime discrete messages are passed over a stream protocol.

Your comments resulted in a small amount of inspiration :) The
_at_least_n functionality has been retained in 0.3.5 through an
additional function object argument to asio::read()/write() etc. In
practice this means that where you used to write:

  asio::read_at_least_n(s, bufs, 42, handler);

you now write:

  asio::read(s, bufs, asio::transfer_at_least(42));


Boost list run by bdawes at, gregod at, cpdaniel at, john at