OpenTP1 Version 7 TP1/Client User's Guide TP1/Client/J

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

2.1.1 Establishing and releasing a permanent connection

You call the openConnection method to establish a permanent connection. You specify the location of the target RAP-processing server in an argument of the openConnection method or in the dchost operand in the TP1/Client/J environment definition and the dcrapport operand. If there is a firewall between the CUP and the RAP-processing listener and server, you must specify the location of the firewall instead of the RAP-processing server.

If the openConnection method returns an exception, the permanent connection has not been established.

TP1/Client/J can establish only one permanent connection per CUP at a time. TP1/Client/J supports two permanent connection modes, depending on the management method:

Non-auto connect mode
In the non-auto connect mode, TP1/Client/J calls explicitly the openConnection method with a CUP and establishes a connection with the RAP-processing server or RAP-processing listener of TP1/Server. If the rpcCall method is called before the openConnection method is called, the rpcCall method returns ErrProtoException. To release the connection, call the closeConnection method with CUP.

Auto connect mode
The auto connect mode manages the connection with TP1/Client/J. If TP1/Client/J determines that a connection has not been established when the first rpcCall or trnBegin method is called, it automatically establishes a permanent connection with the RAP-processing listener and server. In this case, there is no need to call the openConnection method. If the openConnection method is called, the method returns ErrProtoException. You can release the connection within the rpcClose method. To forcibly release a TP1/Client/J-managed connection, call the closeConnection method.

You use the dcrapautoconnect operand in the TP1/Client/J environment definition or the setRpcextend method to specify the mode that is to be used (non-auto connect mode or auto connect mode).

TP1/Client/J uses a permanent connection for message transmission until the permanent connection is released by the closeConnection method. However, some errors will also cause the permanent connection to be released.

The following figure shows the procedure for establishing and releasing a permanent connection.

Figure 2-1 Establishing and releasing a permanent connection

[Figure]