Server/exec/fork questions

jim frost madd at world.std.com
Mon Oct 23 03:30:27 AEST 1989


In article <599 at voodoo.UUCP> jdt at voodoo.UUCP (Jim Tomlinson) writes:
|I _could_ put the code for
|the process that receives data right in the server;
|The folks I work with feel that exec'ing the
|'receive data' part of the process is the best solution, as each process
|(listen and receive) contains only the code essential to doing it's job.
|I'll buy that, but how do I pass that established socket connection to
|the exec'ed process?  Does a socket, like an open file descriptor, remain
|open in the exec'ed process?

I always make the server the handler as well; it's easy and the server
portion of the handler is trivial.  Unless you have very strict memory
constraints there's not a lot of reason for not doing this.  More in a
second.

As for passing sockets to exec'ed processes, they are file descriptors
and work just fine.  Inetd does this; socket connections are passed to
the client as fd 0 (normally stdin).  If you really don't want to put
server code in your handler, use inetd and don't worry about it.  I
tend to allow both kinds of operation since it's pretty simple.

jim frost
software tool & die
madd at std.com



More information about the Comp.unix.questions mailing list