OpenTP1 Version 7 Programming Guide

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

5.1.4 Conversational service paradigm

This subsection explains the conversational service paradigm available with the XATMI interface. Communication based on this paradigm is possible only when the communication protocol is TCP/IP. If OSI TP is used as the communication protocol, the conversational service paradigm is not available.

Organization of this subsection
(1) Procedure for communication based on conversational service paradigm
(2) Time monitoring involved in communication based on conversational service paradigm
(3) Relationship between communication based on conversational service paradigm and transaction
(4) Responses to blocking
(5) Event reception

(1) Procedure for communication based on conversational service paradigm

Communication based on this paradigm is started after a connection is established with the destination party through the issuance of a function. The procedure for requesting service is as follows:

(a) Connection establishment

The client UAP establishes a connection with the service function by the function tpconnect() [TPCONNECT]. The UAP process that established the connection by using the function tpconnect() is referred to as the originator and the remote UAP process is referred to as the subordinator.

When the function tpconnect() returns normally, a positive descriptor that identifies the established connection is returned. This descriptor is assigned to the communication function and communication starts.

When the function tpreturn() is called by the service function to terminate the process, the connection is terminated.

Connection control authority:
Either TPSENDONLY or TPRECVONLY that indicates whether the process has control authority should be specified for the flags argument to the function tpconnect(). If TPSENDONLY is specified, the process acquires control authority so that it can call the data sending function tpsend(). In contrast, if TPRECVONLY is set, control authority is passed to the remote process so that the caller process of the function tpconnect() can call the data reception function tprecv().
(b) Data sending (tpsend())

To send data, call the function tpsend() [TPSEND]. Set the descriptor returned by the function tpconnect() for the argument to the function tpsend() so that the connection to be used can be identified.

No communication party can call the function tpsend() if it has not connection control authority. Even if called, the function tpsend() returns with an error.

To pass connection control authority to the remote process, specify TPRECVONLY for flags of the function tpsend(). By using the function tpsend() with this flag specified, control authority is passed to the remote process.

To send data from the subordinator with the function tpsend(), use the descriptor obtained from the received TPSVCINFO structure.

(c) Data receiving (tprecv())

To receive data, call the function tprecv() [TPRECV]. Data is received asynchronously. The function tprecv() can be issued from processes that have no control authority.

Time monitoring:
If TPNOBLOCK is not specified for flags, the function tprecv() waits until data is received. The maximum response waiting interval is specified in the OpenTP1 definition. For details of the definition, see the manual OpenTP1 System Definition.
If the process which calls the function tprecv() is under a transaction, the maximum response waiting interval is the value assigned to trn_expiration_time in the OpenTP1 system definition. In this case, the process terminates abnormally when the maximum response waiting interval expires (tprecv() does not return with an error).
If the process which calls the function tprecv() is not under a transaction, the maximum response waiting interval is the value assigned to watch_time in the OpenTP1 system definition. In this case, the function tprecv() returns with an error when the maximum response waiting interval expires.
(d) Disconnection

A connection is terminated normally when processing of the service function is completed and the function tpreturn() [TPRETURN] is called with appropriate control authority. A connection may also be terminated due to a communication error.

(e) Forced disconnection (tpdiscon())

To forcibly terminate a connection for some reason, call the function tpdiscon() [TPDISCON]. The descriptor specified in the function tpdiscon() has no effect on the subsequent processes. For transaction processing, the transaction branch on the subordinator enters rollback_only status.

The figure below shows the communication based on the conversational service paradigm.

Figure 5-4 Communication based on conversational service paradigm

[Figure]

(2) Time monitoring involved in communication based on conversational service paradigm

In communication based on the conversational service paradigm, time monitoring is always performed according to the values specified in the OpenTP1 definition. For details on the definition, see the manual OpenTP1 System Definition.

There are two types of timeout: transaction timeout and blocking timeout. The transaction timeout is a timeout that is encountered during the transaction process, whereas the blocking timeout is caused by a wait in blocking status. If a transaction timeout occurs, the process terminates abnormally.

The process may wait beyond the specified timeout value (because the OpenTP1 monitoring timer is reset even if a response other than the appropriate data is returned). If TPNOTIME is specified for flags, the timeout value is infinite. Note that the transaction timeout occurs regardless of whether this flag is set.

(3) Relationship between communication based on conversational service paradigm and transaction

The transaction is controlled by a transaction control function available with OpenTP1 (function dc_trn_~ or tx_~). Whether the transaction under OpenTP1 is settled or in rollback_only status is determined from the result of the service function or the transaction control function. In communication based on the conversational service paradigm, however, the transaction branch concerned enters rollback_only status if one of the following errors occurs:

If the caller process is under a transaction, whether the called service is treated as a transaction is determined by the parameter set in the flags argument to the function tpconnect(). Set TPNOTRAN only when the called service is not to be treated as a transaction. A transaction timeout may occur even if TPNOTRAN is set.

(4) Responses to blocking

Functions for communication based on the conversational service paradigm have the TPNOBLOCK flag that indicates the necessary action against blocking. The function tprecv() with this flag returns with an error if it detects blocking. If this flag is not set, the function waits until blocking is removed or a timeout occurs (if TPNOTIME is set, however, no blocking timeout error occurs). With OpenTP1, this flag has effect only on the function tprecv(). Even if this flag is set for the function tpconnect() or tpsend(), it is ignored.

(5) Event reception

If an event exists in the descriptor cd that identifies the connection, it can be received by the function (tpsend() or tprecv()) for communication based on the conversational service paradigm. The event provides communication-related information. For details, see the applicable OpenTP1 Programming Reference manual.