Boost logo

Boost :

From: Simon Richter (Simon.Richter_at_[hidden])
Date: 2005-06-08 04:51:52


Hi,

pedro.lamarao_at_[hidden] schrieb:
> To spice up the networking discussion, let me announce a new version of
> my networking experiment, the socketstream library.

I have a similar thing on its way, where I do things a little
differently, but the general direction is the same.

The biggest difference in my implementation is that listeners and
connected sockets are constructed with a string (of arbitrary character
type) rather than an address family specific type, i.e. the application
need not see any types representing addresses. The string is searched
for a whitespace character, with the portion before it being the address
family and the remainder the (af specific) address.

I have tried to get a bit away from the C socket functions, because I
felt they were not really needed. For example, bind() can be avoided by
a two-argument form of connect() that binds before connecting (and
believe me, you do not want to know what #include <sys/socket.h> on
Solaris does to code that contains the word "bind").

The other difference in API is that accepted sockets are extracted from
the listener, not returned as an auto_ptr. This leads to slight ugliness
in the implementation (copyfmt() and a set of callbacks) but looks
really nice in the application source code. I also wonder whether I
should provide a way to get a "one-shot" listener that will accept a
single connection and give it as a stream to the application.

The thing I am missing in your implementation (but that's also still
missing in mine :-P) is a wrapper around select() /
WaitForMultipleObjects() / Wait() / ... along with the ability to run a
resolver in the background and get a notification on connection
establishment/failure.

   Simon




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk