Path: utzoo!attcan!uunet!mcvax!kth!draken!chalmers!myab!lars From: lars@myab.se (Lars Pensj|) Newsgroups: comp.unix.questions Subject: Re: System V message queues? Message-ID: <456@myab.se> Date: 2 Mar 89 13:09:55 GMT References: <561@pvab.PVAB.SE> <4043@ingr.com> Reply-To: lars@myab.UUCP (Lars Pensj|) Organization: Myab Gothenburg, Sweden Lines: 21 In article <4043@ingr.com> crossgl@ingr.UUCP (Gordon Cross) writes: >The correct way to use message >queues for interprocess communication is to create it using a value for >'key' that is known (or can be determined) by the other processes that wish >to use the queue. There is a function 'ftok' available that can be used to >generate such a key. It requires the path name of an existing file and an >unique id (the manual suggests that this id should uniquely identify a >project). My personal opinion of 'ftok' is UGHHHH! I usually just pick >some random number and use that as the key then we register this number so >no other project will use the same one. My opinion of ftok() is that it should have been mandatory. If you use ftok() on a local file, you will get a unique key. If you want more than one unique key, use an id value of 0, 1 and so on for the same file. Never use a random number, it can collide with other programs ! -- Lars Pensj| lars@myab.se