From: Michel André (michel.andre_at_[hidden])
Date: 2005-04-22 01:50:03
Jeff Garland wrote:
> This kind of code needs to be banished from all socket examples and libraries.
> We need buffer type that the "network infrastructure" can 'know' the size of
> and possibly even resize if needed. These type of assumed/fixed size buffers
> are bad design -- simply unacceptable in my mind for a modern C++ library.
> I notice we don't have a buffer concept in any of our net/socket writeups on
> the wiki. I think that's a big omission. I also wonder if the abstraction
> doesn't already exist --> std::basic_streambuf. Let the socket class write
> into the streambuf and then you can trivially wrap a stream around it to do
> sophisticated i/o if you wish -- or simply pull out the raw chars....
So basically you propose something like using basic_streambuf<unsigned
char> or basic_streambuf<char> in the interfaces instead of void*, size?
The reason I haven't got any buffer Is that I don't want to impose a
buffering strategy or interface onto the user.
Isn't streambuf interface more related to io with locale and
char_traits. Wouldn't a simpler concept do just buffer with just checked
read/write and size/resize.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk