Using NS3000/iX Network Services (36920-90008)

152 Chapter 7
Remote Process Management
RPM Program Examples
RPM Program Examples
The following two Pascal programs illustrate the use of the RPM
intrinsics. The first program creates a new process (the second
program) on a remote node. It also creates a remote session for the
second program to run in. At the same time, it passes strings
containing a socket name and a node name to the remote process. This
information enables the second program to establish a connection to the
first.
In greater detail, the first program:
creates a call socket and names it;
reads the name of the node on which it is running;
initializes the opt parameter with strings containing the socket’s
name and the name of the node on which it is running;
creates a new process with the program name CREATURE on a
remote node, passing the strings to the new process;
waits for a connection request from the remote process (and
establishes the connection);
shuts down its call socket;
executes a loop in which it:
calls a procedure that receives a message by executing two
IPCRECV loops. The first loop determines the incoming message
length. The second loop receives data until all the pieces of the
message have been received.
prints the message that was received;
receives a “last message” termination request;
sends a “termination confirmation message” in response to the
termination request;
receives a result parameter value of 64 (“REMOTE ABORTED
CONNECTION”) in response to a receive request;
releases its VC socket.
The execution of the second program is initiated by the first program.
The second program:
obtains the socket name and node name passed by the creator;
uses these names to acquire a destination descriptor for the socket;
creates a call socket for itself, sends a connection request to the
creator’s socket, and establishes a connection to the creator process;