As far as the message-passing aspects are concerned, the server handles message passing in two stages; a receive stage and a reply stage:
We'll look initially at two simple versions of these functions, MsgReceive() and MsgReply(), and then later see some of the variants.
#include <sys/neutrino.h> int MsgReceive (int chid, void *rmsg, size_t rbytes, struct _msg_info *info); int MsgReply (int rcvid, int status, const void *msg, int nbytes);
Let's look at how the parameters relate:
As you can see from the diagram, there are four things we need to talk about:
You may have noticed that there are two sizes for every buffer transfer (in the client send case, there's sbytes on the client side and rbytes on the server side; in the server reply case, there's sbytes on the server side and rbytes on the client side.) The two sets of sizes are present so that the programmers of each component can specify the sizes of their buffers. This is done for added safety.
In our example, the MsgSend() buffer's size was the same as the message string's length. Let's look at the server and see how the size is used there.