Path: utzoo!attcan!uunet!peregrine!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!uw-beaver!fluke!gtisqr!roger From: roger@gtisqr.uucp (Roger Droz) Newsgroups: comp.unix.questions Subject: Re: Help: pipe accross two processes Summary: How 'bout named pipes. Message-ID: <1990Dec5.225853.1370@gtisqr.uucp> Date: 5 Dec 90 22:58:53 GMT References: <1510@ulowell.ulowell.edu> Organization: Global Tech International Inc. Lines: 32 In article <1510@ulowell.ulowell.edu> mchetan@hawk.ulowell.edu (Munisuvratha Chetan) writes: > >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. How about using named pipes. (See mknod(1)) The server can open(2) several named pipes with O_NDELAY set and start polling. The clients don't need to know the process id of the server; just the directory where the set of named pipes can be found. The clients can tell when they open a pipe for writing if a reader (the server) is running. You will need to come up with some mechanism of lock files to keep two clients from opening the same pipe. You will also need two pipes for each client to accomplish two way communication, but I assume you already know that. There are other ways of doing this sort of thing in Unix, but you said you wanted to use pipes. ____________ Roger Droz UUCP: uw-beaver!gtisqr!roger () () Maverick MICRoSystems / Global Technology International (_______) Mukilteo, WA ( ) | | Disclaimer: "We're all mavericks here: | | Each of us has our own opinions, (___) and the company has yet different ones!"