How it works...
We will start by generating an IPC key by invoking the ftok function. The filename and ID are supplied while creating the IPC key are messagefile and a, respectively. The generated key is assigned to the key variable. Thereafter, we will invoke the msgget function to create a new message queue. The message queue is associated with the IPC key we just created using the ftok function.
Next, we will define a structure by the name of msgstruc with two members, mtype and mesg. The mtype member helps in determining the sequence number of the message that is going to be sent or received from the message queue. The mesg member contains the message that is going to be read or written into the message queue. We will define a variable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access