Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 6
Checking a Request Against the Opener Table
ERROR^NUMBER);
END;
Checking a Request Against the Opener Table
If the message received on $RECEIVE is a user message, then you need to check that
the sender of the message has the server open. To do this, you scan each entry of the
opener table looking for a match with the process handle and file number of the
message sender. If no match is found, then you should reject the user request with
error number 60. If a match is found, process the message.
The following example checks the opener table for a match:
I := 1;
WHILE I <= MAX^OPENERS DO
BEGIN
IF RECEIVE^INFO[6] '='
OPENER^TABLE[I].PROCESS^HANDLE[0] FOR 10 WORDS
AND RECEIVE^INFO[3] = OPENER^TABLE[I].FILE^NUMBER THEN
BEGIN
!Process the user message
.
.
.
ERROR^NUMBER := 0;
RETURN;
END;
I := I + 1;
END;
ERROR^NUMBER := 60;
Deleting a Requester From the Opener Table
The server process must delete the requester from its opener table whenever a
requester no longer needs the service. The following situations can cause this:
The requester closes the server.
The CPU on which a requester is running fails.
The network connection between the requester and server fails.