Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
first of all give some more clarity to us about your question

having said that I assumed the below things
I think you are talking about ftok
from this I understood it.

"Are you the Key Master?" What about this key nonsense? How do we create one? Well, since the ty +pe key_t is actually just a long, you can use any number you want. Bu +t what if you hard-code the number and some other unrelated program h +ardcodes the same number but wants another queue? The solution is to +use the ftok() function which generates a key from two arguments: key_t ftok(const char *path, int id); Ok, this is getting weird. Basically, path just has to be a file that +this process can read. The other argument, id is usually just set to +some arbitrary char, like 'A'. The ftok() function uses information a +bout the named file (like inode number, etc.) and the id to generate +a probably-unique key for msgget(). Programs that want to use the sam +e queue must generate the same key, so they must pass the same parame +ters to ftok(). Finally, it's time to make the call: #include <sys/msg.h> key = ftok("/home/beej/somefile", 'b'); msqid = msgget(key, 0666 | IPC_CREAT); In the above example, I set the permissions on the queue to 666 (or rw +-rw-rw-, if that makes more sense to you). And now we have msqid whic +h will be used to send and receive messages from the queue.
at the same time IPC::SysV has the function ftok, which you can try and use.


Vivek
-- 'I' am not the body, 'I' am the 'soul', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.

In reply to Re: Key for message queue creation... by targetsmart
in thread Key for message queue creation... by leslie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (7)
    As of 2014-10-01 22:29 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      What is your favourite meta-syntactic variable name?














      Results (40 votes), past polls