From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-05 09:58:50
"Bronek Kozicki" <brok_at_[hidden]> wrote in message
> Jeff Garland wrote:
> > The Iostreams Library serves two main purposes:
> > * To allow the easy creation of standard C++ stream and stream buffer
> > for new data sources and sinks.
> Sorry for jumping with this question out of nowhere : is it possible to
> use Iostreams to provide stream-like access to sockets, ie. make
> platform-independent abstraction over platform-dependent sockets library?
Yes. I have done this. I wanted to included an example, but there would have
been too much extra code to include.
There will be better support for sockets if the library is extended to handle
non-blocking, asynchronous and/or multiplexed i/o. For now, you can write a
socket_resource with read and write members which are wrappers around api calls.
You must be careful to meet the current specifications of read and write,
according to which returning read fewer characters than requested signals EOF,
and writing fewer than requested is an error.
In my view, one of the major open questions about the library design is whether
and how to allow a filter or resource to process fewer characters than requested
without indicating and error or EOF.
Please see 'Planned Changes'-->Item 4 (http://tinyurl.com/6rtkz) and 'Fututer
I'm very eager to hear how people think these issues should be handled.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk