Date: Wed, 13 Nov 1996 12:03:22 -0600 (CST) From: Joe Greco <jgreco@brasil.moneng.mei.com> To: exidor@superior.net (Christopher Masto) Cc: hackers@FreeBSD.ORG Subject: Re: Programming technique for non-forking servers? Message-ID: <199611131803.MAA23482@brasil.moneng.mei.com> In-Reply-To: <199611131705.MAA10785@nimbus.superior.net> from "Christopher Masto" at Nov 13, 96 12:05:50 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> This reminds me of a related thing that's been nagging me since I > first started writing Unix programs about 5 years ago. Occasionally > (more often recently) I'm working on something that screams for a > couple of cooperating processes.. coming from the Amiga world, this > seems very natural, and on the Amiga it was very simple. One process > opens up a "message port", and another process sends messages to it. > The closest thing I have seen is creating a socket in the Unix > domain.. but this doesn't seem very popular, so I get the feeling it > isn't often the right answer. As far as I can tell... you're wrong. :-) UNIX is fundamentally different from crud like DOS... interprocess communication is a core part of the system and is actively encouraged. Build your own tools from shell commands. Write your own C code that opens dozens of sockets. That should be relatively similar to the Amiga world, as I understand it, although I have never owned one. I think what puts off most relative newcomers is the complexity of the BSD socket paradigm. This is NOT intended to prevent or discourage you from using it! It is simply due to the incredible flexibility inherent in a network-aware interprocess communication layer. Where else can you whip out a dozen lines of C code that connects to a process in Japan and starts talking to it? If you find it somewhat more complex than you would prefer, write library functions to simplify the "grunt work". You will not be able to cover every scenario, but you can cover the common ones where you just want to open a connection to someplace. Even though I have been doing this stuff for a long time now, I still use a set of library routines I wrote a long time ago, because in 90% of the cases, I just want to do something simple. There are, of course, other forms of IPC available as well. IPC is _great_. It is _often_ the right answer. ... JG
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611131803.MAA23482>