I've got a problem.
I have a process, let's say it is a client, and a process called server. Client and server communicate with each other by the same queue. Let's say a client sends a message to the server (request), so the server processes it and should send message back to client a confirmation or a failure. Let's say that confirmation has a long type = 1500101
, and failure has long type = 1500102
.
Is it possible (using msgrcv in C) to wait for only those two types of messages (client) ? If not, what is the best way to do such a mechanism?
No, you can't receive on multiple messages types. It's either all or just a single type or all except a single type.
What you can do is call msgrcv
with the IPC_NOWAIT
flag twice, once for each type.