Help: pipe accross two processes

Leslie Mikesell les at chinet.chi.il.us
Fri Dec 7 06:43:10 AEST 1990


In article <1990Dec5.225853.1370 at gtisqr.uucp> roger at gtisqr.uucp (Roger Droz) writes:

>The server can open(2) several named pipes with O_NDELAY set and start
>polling. 

>You will need to come up with some mechanism of lock files to keep two
>clients from opening the same pipe.

On the contrary - the server can accept all input from a single pipe
and not have to bother with O_NDELAY or polling.  The constraint to
this method is that a logical request from a client (i.e. the chunk
of data that can't be interleaved with requests from other clients)
must be less than PIPE_BUF (typically 5120) bytes and delivered in
a single write().  Also, all writes() must use a pre-arranged fixed
length, a length count as the first field, or a delimiter of some
sort to allow the server to find the boundaries.  A server running in
this mode would generally open the FIFO for write access itself even
though it will never write to it in order to make the reads block
until a client completes a write().
 
>You will also need two pipes for each
>client to accomplish two way communication, but I assume you already know
>that.

The client still needs one pipe of its own for communication in the
other direction.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.questions mailing list