Server and Client Tasks

Synchronous message passing is great for dividing tasks into server tasks and client tasks. A server task uses the “receive” function to listen for requests, and client tasks use the “send” function to request services.

An example:

server:

 

while (REXIS_MessageReceive(&sender_id, buf, sizeof (buf)) >= 0)

      {

      ... // perform task and reply

      REXIS_MessageReply(sender_id, replybuf, sizeof (replybuf));

      }

...

client:

if (REXIS_MessageSend(server_id, sendbuf, sizeof (sendbuf), requestbuf, sizeof (requestbuf)) >= 0)

      {

      ... // perform task

      }