
Simon Richter wrote:
Hi,
Caleb Epstein wrote:
Please do! Does either of the implementations offer an interface to the sockets at a lower level than iostreams though?
Mine doesn't, so far, as I haven't seen a need for it.
I believe it is an absolute requirement for a C++ Sockets library.
Hrm, I have never missed being able to access files from a lower level than iostreams so far. :-) I never do binary I/O directly in my applications but always implement an inserter/extractor pair that uses streambuf iterators, though.
See ? As soon as you don't care for formatting you do want access to the underlaying streambuf object, which, in this case, would be a much more suitable place to put the extra API to manipulate socket-specific options.
iostreams' read()/write() should be enough for stream-based I/O, and for datagrams I'd propose going through another step anyway (i.e. have a separate stream class that does not derive from the standard iostreams but rather allows inserting and extracting packets only.
Why use iostream's read if you can do that on the streambuf object directly. And, why use the concept of a 'stream' at all when dealing with datagrams ? That doesn't sound like a good fit to me. Regards, Stefan