sean@ms.uky.edu (Sean Casey) (06/16/91)
Okay so I'm writing an application where two dissimilar processes need to shove pieces of data at each other in a non-blocking fashion. Process A talks to processes B, C, and D in a star fashion. Any of these processes can be restarted if necessary. I could do one of the following: - FIFOs, which are likely to be the most efficient implementation, but which might be less portable than sockets. But there's POSIX... - UNIX domain sockets, which are (IMHO) a little funkier to set up. But I'm comfy with sockets so that's no real trouble. One thing I noticed is that when a program opens a named pipe, and there's nothing else that has it open, then it just blocks indefinitely, while a UNIX domain socket will get the connection refused if there's nothing to listen. Anyone care to share experiences with the relative merits of the two? Sean -- ** Sean Casey <sean@s.ms.uky.edu>
peter@ficc.ferranti.com (Peter da Silva) (06/21/91)
In article <1991Jun15.204226.25191@ms.uky.edu> sean@ms.uky.edu (Sean Casey) writes: > One thing I noticed is that when a program opens a named pipe, and > there's nothing else that has it open, then it just blocks > indefinitely, while a UNIX domain socket will get the connection > refused if there's nothing to listen. Can't you open with O_NDELAY or equivalent? -- Peter da Silva; Ferranti International Controls Corporation; +1 713 274 5180; Sugar Land, TX 77487-5012; `-_-' "Have you hugged your wolf, today?"
flee@cs.psu.edu (Felix Lee) (06/22/91)
> Can't you open with O_NDELAY or equivalent?
Now all we need is a shell syntax for opening with O_NDELAY set.
Otherwise it becomes tricky to do things like
echo `date` begin >> log
if you don't know whether log is a named pipe or not.
And you also need shell access to O_SYNC, O_APPEND, O_EXCL, etc.
Perhaps rather than file redirection we need an "open" command:
echo hello | open -WRONLY,NDELAY,SYNC,APPEND log
--
Felix Lee flee@cs.psu.edu