1. Create IPC Facility Key
key_t mykey;
mykey = ftok(".", 'a');
2. Create Message Queue
qid = msgget(mykey, 0600 | IPC_CREATE);
3. Receive/Send Message
msgrcv(qid, buf, len, type, 0));
packet.mtype = type;
len = sizeof(packet) - sizeof(long);
msgsnd(qid, &packet, len, 0);
msgsnd(qid, &packet, len, 0);
4. Remove Message Queue
msgctl(qid, IPC_RMID, 0);
5. The ipcs / ipcrm command
ipcs -q
ipcs -s
ipcs -m
ipcrm -q xxxx
ipcrm -s xxxx
ipcrm -m xxxx