Boost logo

Boost :

From: Michael D. Crawford (crawford_at_[hidden])
Date: 2000-12-28 18:54:08


I agree that whatever you call your network endpoint in a portable
library, you shouldn't call it a socket. It's too loaded with meaning
to people who don't know how other platforms work.

In Unix, TCP sockets are file descriptors and are inherited by child
processes after a fork. It's a great technique, but it's unfortunately
become assumed by a lot of people that that's just how TCP works even
though it's highly platform specific.

I'm not sure if they've got the new networking architecture in the BeOS
yet, but in the older versions of it the networking was done from a user
process and although BeOS file descriptors were inherited by child
processes, network sockets were not file descriptors and so although
BeOS was pretty Unixy when writing a command-line program it wouldn't
work for most Unix network server code.

On the classic Mac OS there really is no concept of a child process, I
think the only way the concept is supported is that you can find out if
a process that you launch has terminated. I think this is mainly
provided for use by source debuggers. Someone commented that it was
fine if you could get things to work on Windows and Unix but I don't
think you should count out the Mac OS - Apple was one of the early
adopters of C++ (I used the Mac port of cfront under MPW in 1990) and
what started out as a tiny Mac compiler publisher (Metrowerks) is a big
player in cross-platform C++ as well as embedded compilers.

For what I feel is a pretty good example of portable TCP networking, see
the networking classes in ZooLib, http://zoolib.sourceforge.net These
work with Windows (winsock) networking, Mac OS MacTCP (I think Open
Transport may be in there or is being worked on), and Berkeley sockets
on BeOS and Unix.

It's combined with the stream classes provided by ZooLib so you can have
network streams, and the stream classes can act as filters so you can do
some kinds of protocols via streams.

While there may be things about it you'd want to improve on, the code is
in use in real commercial products that work as clients and servers
handling thousands of clients.

It's available under the MIT license, which I haven't checked but I
think should be OK with what Boost requires for a license (this is the
same license as XFree86 and the core X11 distribution).

It is, I'm afraid, as yet undocumented. I'll be writing documentation
for ZooLib Real Soon Now. But I am happy to answer questions and I'm
sure ZooLib author Andy Green would be too.

-- 
Michael D. Crawford
GoingWare Inc. - Expert Software Development and Consulting
http://www.goingware.com/
crawford_at_[hidden]
   Tilting at Windmills for a Better Tomorrow.

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