Help: pipe accross two processes

Leslie Mikesell les at chinet.chi.il.us
Tue Dec 4 16:01:17 AEST 1990


In article <1510 at ulowell.ulowell.edu> mchetan at hawk.ulowell.edu (Munisuvratha Chetan) writes:
>I have a problem with "pipe"s, which might have appeared earlier.

>I have two processes - a server and a client.
>The server runs in an infinite loop untill killed.
>After the server is brought up, clients wil be forked, from a
>different shell.  If the clients know the process id of the
>server, how can I establish a communication channel between the
>two using pipes (and signals, if necessary) only.
>I know how to create pipes between a parent and child.

If your system supports FIFOs  (named pipes) just let the server create
on using a name known to the clients.  All clients can write to
the single FIFO read by the server (with some care to keep things that
must not be interleaved in a single write()), and this will automatically
schedule the requests.  Communicating back to the client is a different
problem.  Depending on the circumstances, you might want the client to
create a FIFO as well and pass its name in the request to the server, or
you might use shared memory or ordinary files with the server sending a
signal to the client when the output is completed and safe to read.
(See the man page for mknod to find out if you have named pipes.)

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.questions mailing list