NetIPC 3000/XL Programmer's Reference Manual (5958-8600)
Table Of Contents
- 1 NetIPC Fundamentals
- 2 Cross-System NetIPC
- 3 NetIPC Intrinsics
- 4 NetIPC Examples
- A IPC Interpreter (IPCINT)
- B Cause and Diagnostic Codes
- C ErrorMessages
- D Migration From PTOP to NetIPC and RPM
- E C Program Language Considerations

226 AppendixD
Migration From PTOP to NetIPC and RPM
Example: Client-Server Application
{----------------------------------------------------------------}
{ RECV receives a specified number of bytes from the virtual }
{ circuit (vc) connection. This compensates for the stream mode }
{ operation of NetIPC on the HP 3000, where an IPCRECV can return}
{ less than the requested number of bytes. The loop in RECV }
{ calls IPCRECV to receive the next chunk of data, until the }
{ requested amount of data has been received. Note that buf }
{ must be unpacked to allow it to be indexed in the IPCRECV call.}
{----------------------------------------------------------------}
begin
result := 0;
nextbufchar := 1;
while (length > 0) and (result = 0) do
begin
recvlength := length;
IPCRECV( vcdesc, buf[nextbufchar], recvlength, , , result );
nextbufchar := nextbufchar + recvlength;
length := length - recvlength;
end;
end; {RECV}
begin
{-----------------------}
{ Get client node name. }
{-----------------------}
NSINFO( , , envnum, status,
clocalnodelength, clientnodelength,
clocalnode, clientnode );
if status <> 0 then
ERROR( 'Couldn't get client node name.', status );
{-------------------------------------------------------------}
{ Create and name client's socket. The socket length of 0 in }
{ IPCNAME will cause it to return a random 8-byte socket name.}
{-------------------------------------------------------------}
IPCCREATE( callsocket, tcpprotocol, , , socketdesc, result );
if result <> 0 then
ERROR( 'Couldn't create local socket.', result );
IPCNAME( socketdesc, clientsockname, 0, result );
if result <> 0 then
ERROR( 'Couldn't name client socket.', result );
{-------------------------------------------------------------}
{ Build the opt array for the RPMCREATE call, including RPM }
{ strings for the client's socket name and node name. }
{-------------------------------------------------------------}
INITOPT( opt, 2 );
ADDOPT ( opt, 0, optrpmstring, socketnamelength, clientsockname );
ADDOPT ( opt, 1, optrpmstring, clientnodelength, clientnode );
{-------------------------------------------}
{ Get the server's node name from the user. }
{-------------------------------------------}
prompt('Client: Enter the remote node name: ');
readln( location );