What happens when a process reads an IPC message with msgrcv?
Why I can’t read a message with the same mtype more than once?
Code for the structure being used:
struct msgbuff{
long mtype;
char mtext[150];
};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A message can only be read once. This is how the msgrcv manpage describes its function:
There is no way to peek at the queue. If you need that you could pop an item from the queue with msgrcv() and then add it again using msgsnd(). There is a risk that will fail (queue full, out of memory, etc.) so it is not foolproof.