|
» |
|
|
|
With PTOP, the creation of the slave process and the set up
of the communications channel is done by the POPEN call in the master and the first GET and ACCEPT (or REJECT) calls in the slave. The POPEN call specifies the remote node's location,
the name of the program on the remote node to be created, and various
process-creation parameters. The dsnum parameter returned by POPEN identifies the slave process and its communications
channel. On the slave side, the GET and ACCEPT calls complete the set up. With NetIPC and RPM, the actions of creating the slave process
and setting up the communications channel are split up. RPM handles
the process creation, while NetIPC handles the communications. The
calls necessary for these tasks are more complicated than the POPEN and GET/ACCEPT calls. The master process creates a call socket
and registers it in the local socket registry. It passes the name
of the socket and the local node name to the slave by using the
RPM string feature of RPMCREATE. The master calls RPMCREATE to create the slave, including any process-creation
parameters. The slave retrieves the master socket and node names
from the RPM strings. It creates its own socket, looks up the master's
socket, and establishes a virtual-circuit connection between the
two sockets. The steps for each side are given below. Creating Remote Processes: In the Master Program | |
To convert the PTOP intrinsic listed below, perform the following
steps. Syntax | |
dsnum := POPEN (location,progname [,itag][,entryname] [,param][,flags][,stacksize][,dlsize][,maxdata][,bufsize]) |
Get the local node name. You can use
the NSINFO intrinsic, provided that you execute a DSLINE or a REMOTE command prior to the call. This should normally be the
case for a PTOP application. You can use local node name and length
item numbers (19 and 18) in NSINFO.
| | | | | NOTE: NSINFO is supported on NS 3000/V starting with
UB-delta-1 MIT and on NS 3000/XL with Release 1.1.) | | | | |
Create a TCP call socket for the master
program and name the socket, using the IPCCREATE and IPCNAME intrinsics. You can use a randomly generated name
from IPCNAME. Build the opt array for the RPMCREATE call, using the INITOPT and ADDOPT intrinsics. In the opt array, include RPM strings
(opt code 20000) for the socket name and the local node name. (These
will be used by the slave program to set up the virtual circuit
connection.) If any process-creation options are included in the
POPEN call (entryname, param, flags, stacksize, dlsize, or maxdata), include them in the opt array with the corresponding
RPM opt codes: Parameter | Opt Code |
---|
entry name | 22001 | param | 22002 | flags | 22003 | stacksize | 22004 | dlsize | 22005 | maxdata | 22006 |
Call IPCRECVCN to wait for the connection request from the slave. Save
the returned virtual-circuit descriptor for subsequent IPCSEND and IPCRECV calls. Now that the virtual-circuit connection has been
set up, call IPCSHUTDOWN to delete the master's call socket and
IPCNAMERASE to delete the socket name. If a tag is specified, call IPCSEND to send the tag on the virtual circuit to the
slave. If the slave could respond to the POPEN with either an ACCEPT or a REJECT, call IPCRECV to receive a one-byte accept or reject indication
from the slave. If a tag is specified, call IPCRECV to receive the tag from the slave (but see the
comment on IPCRECV under "Exchanging Data").
Creating Remote Processes: In the Slave Program | |
To convert the PTOP intrinsic listed below, perform the following
steps. Syntax | |
ifun := GET [([itag][il][,ionumber] |
Call RPMGETSTRING twice to get the master's socket name
and node name. Create a TCP call socket by using the IPCCREATE intrinsic. Call IPCLOOKUP to look up the master's socket, using
the master socket name and node name passed in the RPM strings.
This returns a destination descriptor to be used in the
IPCCONNECT call. Set up a virtual-circuit connection between the
master and the slave sockets, using IPCCONNECT. Call IPCRECV to wait for the connection acknowledgment from
the slave. Save the returned virtual-circuit descriptor for subsequent
IPCSEND and IPCRECV calls. After setting up the connection, delete the call
socket and destination descriptor using IPCSHUTDOWN. If a tag is specified, call IPCRECV to receive the master's tag on the virtual
circuit (see the comment on IPCRECV under Data Exchange).
To convert the PTOP intrinsic listed below, perform the following
steps. Syntax | |
ACCEPT [([itag][,target][,tcount])] |
If the slave can call either
ACCEPT or REJECT in response to the POPEN, send a one byte accept or reject indication on
the virtual circuit to the master. If a tag is specified, call IPCSEND to send the slave's tag on the virtual
circuit back to the master.
|