NetIPC 3000/XL Programmer's Reference Manual (5958-8600)

Table Of Contents
Appendix D 211
Migration From PTOP to NetIPC and RPM
Exchanging Data
Exchanging Data
The PTOP data-exchange calls are master-slave. The master initiates
an exchange by calling PWRITE (to send data to the slave), PREAD (to
receive data from the slave) or PCONTROL. The slave calls GET to receive
the request and ACCEPT to perform the actual data movement into or
out of its buffer. Each of these operations may also exchange a tag
between the master and the slave. The master call sends the master tag
to the slave and returns a tag from the slave. The slave’s GET call
receives the master tag. The slave’s ACCEPT or REJECT call returns the
slave’s tag to the master.
The GET intrinsic can return an indication of the master request
(0 = error, 1 = POPEN, 2 = PREAD, 3 = PWRITE, 4 = PCONTROL). In many
applications, the slave will always know the next request that it will
receive from the master, so the function returned by GET is superfluous.
But in some applications, the slave does not know in advance what the
next master request will be, and so it depends on the GET function to
decide on its response to the request. The GET call can also return the
requested length of data to be sent or received. These applications
typically have a loop with a GET that receives the master requests and a
case statement with cases for each of the different functions.
Data exchange with NetIPC is peer-to-peer. A process on either side of a
virtual-circuit connection can send or receive data independently from
its partner. The master-slave data exchange of PTOP can be simulated
using NetIPC calls. For example, a PWRITE in the master can be
replaced by an IPCSEND, while the corresponding GET and ACCEPT in the
slave can be replaced by an IPCRECV. Tags can also be exchanged using
sends and receives.
In applications where the sequence of master requests is not known by
the slave, or where the length of data sent to or received from the slave
is not known, some information in addition to the exchanged data and
tags may need to be transmitted. This includes a) a master request
indication, b) master request lengths, and c) the slave accept or reject
indication.
Because of the way that NetIPC stream mode operates on the HP 3000,
an IPCRECV may not receive all of the data requested. For this reason,
we recommend that you write a procedure that calls IPCRECV in a loop
to receive chunks of data until the entire requested amount is received.
An example of this is in Chapter 4 , “NetIPC Examples,” in this manual.