OpenTP1 Version 7 Programming Guide

[Contents][Index][Back][Next]

2.2.3 Connection mode

The method of managing permanent connections can be classified into two modes according to the method in which the connections are established and released. The mode whereby OpenTP1 manages the establishment and release of connections is called the automatic connection mode. The mode whereby the user manages the establishment and release of connections is called the non-automatic connection mode. In the user service definition for the RAP-processing client, specify whether automatic connection mode or non-automatic connection mode is to be used for managing permanent connections.

Organization of this subsection
(1) Automatic connection mode
(2) Non-automatic connection mode

(1) Automatic connection mode

In this mode, OpenTP1 manages the establishment and release of permanent connections. OpenTP1 automatically establishes a permanent connection when a RAP-processing client calls the function dc_rpc_call() in which the service group name defined in the user service network definition is specified together with the -w option as an argument.

As soon as the RAP-processing client has called the function dc_rpc_call() to request a service from the service group defined in the user service network definition, it calls the function dc_rpc_close(). It maintains the permanent connection until the RPC has returned.

The figure below shows the outline of the automatic connection mode.

Figure 2-26 Outline of automatic connection mode

[Figure]

There is a limit to the number of connections that can be established between the RAP-processing client and the RAP-processing server. If calling the function dc_rpc_call() causes the number of connections to exceed this limit, OpenTP1 automatically releases the least recently used connection among those used by the RAP-processing client process, and then establishes a new connection.

However, OpenTP1 cannot release a connection which is being used by a chained RPC. When OpenTP1 cannot release any connection due to this restriction, the UAP that issued the API goes down.

(2) Non-automatic connection mode

In this mode, the user manages the establishment and release of permanent connections. To establish a connection from a RAP-processing client, call the function dc_rap_connect() [CBLDCRAP('CONNECT')]. To release a connection, call the function dc_rap_disconnect() [CBLDCRAP('DISCNCT')]. The RAP-processing client calls the function dc_rpc_call() in which the service group name defined in the user service network definition is specified together with the -w option as an argument. If the user has not established a permanent connection by the time the RAP-processing client calls the function dc_rpc_call(), the function dc_rpc_call() returns with an error. The return value is DCRPCER_PROTO.

The figure below shows the outline of the non-automatic connection mode.

Figure 2-27 Outline of non-automatic connection mode

[Figure]

If calling the function dc_rap_connect() causes the number of connections to exceed the maximum number of connections which the RAP-processing client can establish with the RAP-processing server, the function dc_rap_connect() returns with an error.