Re: [boost] [asio] Are the _at_least_n functions useful?

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Christopher Kohlhoff Sent: Thursday, November 10, 2005 7:18 PM To: boost@lists.boost.org Subject: [boost] [asio] Are the _at_least_n functions useful?
Hello all,
As part of cleaning up asio's interface I am pondering the utility of the read_at_least_n/write_at_least_n free functions. I'd appreciate hearing from anyone who actually uses these functions (or their async counterparts), and anyone else who has an opinion on the matter :)
[snip]
Cheers, Chris
<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. <aside humorous="hopefully" sentiment="serious"> I am already using asio on [at least] two projects so I have no stake in hurrying the review process. License is Boost. Great support is available on boost@lists.boost.org. Packaging won't change substantially until 1.34. "Accepted" should be a *very* good bet. Take your time. ;) </aside> Regards, Dick Bridges

Hi Dick, --- BRIDGES Dick <Dick.Bridges@us.thalesgroup.com> 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)); Cheers, Chris

Hi Chris, "Christopher Kohlhoff" <chris@kohlhoff.com> wrote in message news:20051118121202.6477.qmail@web32602.mail.mud.yahoo.com...
Hi Dick,
[snip]
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));
Cheers, Chris
Excellent. Thanks - a *lot*. I hope, nay, assume the addition applies to async_read() as well.
participants (3)
-
BRIDGES Dick
-
Christopher Kohlhoff
-
Dick Bridges