|
Boost : |
From: bill_kempf (williamkempf_at_[hidden])
Date: 2001-12-21 11:09:31
--- In boost_at_y..., Darryl Green <green_at_t...> wrote:
> <rant>
> There are LOTS OF platforms in existance that are not win32, un*x
or mac and
> do have BSD socket style networking.
Yes, and your point is?
> There are environments in which using iostreams is BANNED and where
using
> sockets certainly isn't.
Banned? Why and which environments? Embedded? The reasons why
iostreams are avoided there (I don't like the term banned) probably
won't apply to a binary_iostream.
> There are protocols that are not designed so humans can read them,
but are
> designed so the data will fit (either a lot of data, or a small
pipe) and/or
> be efficently processed at each end.
Yes, and that's what a binary_stream will allow you to do.
> There are protocols that have some truly exotic and complex internal
> structure that no amount of iostream handling is going to help
with. Well -
> ok - I guess someone could build some interesting magic for
formatting data
> as (say) ASN.1 via iostreams, but I'm not volunteering.
This shouldn't be too difficult to do. I don't believe it will
require any "interesting magic", either.
> KISS.
YES!
Start with a few basics, such as a socket class and a network_name
class. From this build some higher level abstractions: a socketbuf,
socket_stream and binary_socket_stream (first requires a full
binary_stream library). From these (or maybe from the lower level
socket class, though you'll lose a lot of very useful functionality
if you do this) you build even higher level abstractions along the
lines of what Jeremy's suggested. Build things in layers, keeping
each layer as simple as possible.
Bill Kempf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk