The receive ID (a.k.a. the client cookie)
In the code sample above, notice how we stored the receive ID.
rcvid = MsgReceive (...);
...
MsgReply (rcvid, ...);
This is a key snippet of code, because it illustrates the
binding between receiving a message from a client and
being able to (later) reply to that particular client.
The receive ID is an integer that acts as a
magic cookie
that you'll need to hold onto
if you want to interact with the client later.
What if you lose it?
It's gone. The client will not unblock from the MsgSend() until
you (the server) die, or if the client has a timeout on the
message-passing call (and even then it's tricky; see the
TimerTimeout()
function in the QNX OS C Library Reference.
Also, note that except in one special case (the MsgDeliverEvent() function which we'll look at later), once you've done the MsgReply(), that particular receive ID ceases to have meaning.
This brings us to the MsgReply() function.