Clients are typically simple in structure and many in number. They usually need a single access to a service and they initiate the link to the service. There are usually no critical sections or other locking issues. Abnormal termination of a client, if a service terminates, is the acceptable or desired action. For more information refer to Using Global Objects and Using Events and Interlocks in this book.
Client Libraries
This is the simplest form of a client. The program requires a LIBRARY declaration, which defines where the service provider is located, and a collection of library objects, which define the interface to the service. This implementation strategy is supported by all languages that implement libraries.
Examples
The following is an example of an ALGOL LIBRARY declaration:
LIBRARY SERVICE (LIBACCESS = BYFUNCTION,
FUNCTIONNAME = “SERVICESUPPORT.”);
PROCEDURE REQUEST (BUF);
ARRAY BUF [*];
LIBRARY SERVICE;
REQUEST (BUF);The following is an example of a COBOL LIBRARY declaration:
CHANGE ATTRIBUTE LIBACCESS OF “SERVICE” TO BYFUNCTION. CHANGE ATTRIBUTE FUNCTIONNAME OF “SERVICE” TO “SERVICESUPPORT.”. CALL “REQUEST IN SERVICE” USING BUF
Connection Libraries
This advanced client is only available in ALGOL and NEWP. The program requires a connection block TYPE declaration, which holds declarations for library objects making up the interface, and a SINGLE LIBRARY instance declaration of the connection library type.
Example
An example of an ALGOL SINGLE LIBRARY declaration of the connection library type:
TYPE CONNECTION BLOCK SERVICETYPE; BEGIN PROCEDURE REQUEST (BUF); ARRAY BUF [*]; IMPORTED; END SERVICETYPE; SERVICETYPE SINGLE IMPORTING LIBRARY SERVICE (LIBACCESS = BYFUNCTION, FUNCTIONNAME = “SERVICESUPPORT.”); SERVICE.REQUEST (BUF);
The reasons for choosing a connection library over a client library are
-
The interface declaration is contained inside the connection library type declaration.
-
A connection library is delinked instead of terminated when a service terminates.
-
The interface definition specifies the export of library objects and the imported objects. These implement advanced concepts such as callback functions and client handlers for service events. However, using two-way connections can cause performance problems. For more information about these problems, refer to Hazards of Circular Connections.

