Interprocess Communication
The following DataBasic statements are used for communication between between client and server programs:
CONNECT
Executed by the client program to establish a connection with a server on a
remote system. The parameters required by CONNECT include the identity of the
remote system (the name of a
ACCEPT Executed by a server program, this statement either declares to the local Session Manager the availability of the server to any client which subsequently requests a connection, or establishes a connection to a client which has just requested connection.
Once a session has been started, either the client or the server can send or receive data, or terminate the connection. The following DataBasic statements are used during the session:
SEND Sends data to a communicating program.
RECEIVE Receives data sent by a communicating program. Executes the ELSE clause if no data has been sent.
RECWAIT As RECEIVE, but waits for input. The ELSE clause is executed if an error occurs.
DISCONNECT Terminates a session.
Generally, the relationship of two communicating programs at any time is master/slave, with one program suspended at a RECWAIT statement awaiting input. Error codes are returned which allow the programs to detect, for instance, the voluntary (or involuntary) disconnection of the link so that appropriate action can be taken. The master/slave relationship is not tied to the client/server relationship, which has to do with the program initiating the connection rather than the direction of data transmission.
The topic Program Examples using Interprocess Communication contains a number of example IPC programs.
PLIds
A server process which is started by a client process is allocated the PLId of the client process which starts it. The server retains the PLId of its first client or that of the process by which it was pre-started. The PLId of a client can be obtained with the ACCEPT statement, thus enabling the server to provide location-based security or other location-based functionality.