Xref: utzoo comp.unix.questions:6097 comp.unix.wizards:7128 comp.lang.c:8248 Path: utzoo!mnetor!uunet!unisoft!hoptoad!ptsfa!dmt From: dmt@ptsfa.UUCP (Dave Turner) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: IPC and STREAMS in Unix V.3 Message-ID: <4186@ptsfa.UUCP> Date: 17 Mar 88 02:50:10 GMT References: <117@amtfocus.UUCP> Reply-To: dmt@ptsfa.UUCP (Dave Turner) Organization: Pacific * Bell, San Ramon, CA Lines: 31 Keywords: IPC, STREAMS In article <117@amtfocus.UUCP> irab@amtfocus.UUCP (Ira Brenner) writes: > I have four main processes running simultaneously (A, B, C, D). Process > B needs to communicate with a child (C) and another process, which may > or may not be a child, (D). No direct communication between C and D is > necessary. Process B also needs to communicate with process A. In > could use a few pointers on how to do it. I don't think any of > the other methods of IPC for Unix (shared memory, semephores) are System V messages will do what you want. Have each process open a message queue for reading. The other processes can open the same msg queues for writing. The message could contain the message id if replies are expected (required?). A set of files can be used to allow the processes to open the msg queues. Use ftok() (see stdipc(3c) to convert filenames to key-t's for msgget(). Give the files names that make sense to the set of processes. /usr/spool/xxx/A # the msg queue read by process A /usr/spool/xxx/B # the msg queue read by process B /usr/spool/xxx/C # the msg queue read by process C /usr/spool/xxx/D # the msg queue read by process D Each process should ftok and get its msg queue first. Processes B-D should read (and wait for) messages. Process only needs to read its msg queue occassionally and probably should not wait. -- Dave Turner 415/542-1299 {ihnp4,lll-crg,qantel,pyramid}!ptsfa!dmt