Introduction

This chapter describes the overview, operating structure, and service types of the system.

1. Overview

The SERIAL(RS232) gateway (hereafter SRLGW) is a Tmax gateway, which plays the role of an interface between a Tmax server and a Non-Tmax server (hereafter remote node).

SRLGW can be divided into two modules; one transmits data from Tmax to a remote node through serial communications, and the other is the COM library that is responsible for sending data from a remote node to Tmax SRLGW. The COM library enables the use of serial communications between Tmax and SRLGW, without having to newly develop a program designed for serial communications. A user can use this library to receive or request a service from/to SRLGW.

As such, a user can use bi-directional services using SRLGW of Tmax and the COM library of the remote node, and this eliminates the need of establishing serial connections between Tmax and other systems. For example, since the jobs including opening a port and sending and receiving messages are all processed through SRLGW and COM library, a developer can simply create application logic to easily connect to other systems.

Unlike TCP/IP, SRLGW does not run in two different modes, server and client. Once a serial connection is established, either Tmax or remote node can initiate a service request. SRLGW operates differently depending on which one initiates the service request. The following is the operating structure of SRLWG.

figure 1 1
SRLGW Operation
  • Service Requests Initiated by Tmax

    SRLGW receives a service request from a Tmax client or service and delivers the request to the remote node (represented by the dotted line in SRLGW Operation. When Tmax client makes a service request to the remote node, it uses the name of the service registered in SRLGW. This is called an INBOUND service.

    When the Tmax service sends the service request to SRLGW through tpcall or other protocols, SRLGW delivers the request message to the remote node. When a response is returned, SRLGW sends a tpreturn message to the service.

    SRLGW asynchronously processes the service requests, which are sent from Tmax to the remote node. That is, when a service or client sends a tpcall to the remote node, SRLGW sends the service request to the remote node and returns a normal response to the service or client. Since the remote node regards the response as a new service request, all services requested by Tmax are processed asynchronously.

  • Service Requests Initiated by the Remote Node

    SRLGW receives a service request from a remote node and then processes it (represented by the solid line in SRLGW Operation. When Tmax client receives a service request from the remote node, it uses the service name of Tmax. This is called an OUTBOUND service.

    When SRLGW receives a message from the remote node, it sends a tpacall to the user requested service. The service result is sent back to the remote node which has requested the service. Tmax services requested by the remote node can be processed in an asynchronous or synchronous way.

    In an asynchronous communication, if the flags is set to COMMNOREPLY when a service is requested to SRLGW using the COM library, SRLGW only sends the service request to Tmax and does not receive a response.

    In a synchronous communication, if the flags is not set to COMMNOREPLY when a service is requested to SRLGW using the COM library, SRLGW sends the service request to Tmax and sends back the reply to the remote node.

    Deferred processing is supported when a remote node requests a service to Tmax. When the flags is set to COMMDELAY, SRLGW saves the request data in RQ to allow a user to batch process the data at a later time. Deferred processing is always performed in an asynchronous way.

SRLGW installed on Tmax is a type of Tmax server, and it must be configured as a server in the Tmax environment file. While general servers are created using a TCS or UCS server library, SRLGW is provided as an executable file so that the user can simply add SRLGW as a server in the Tmax environment file.

Since SRLGW can only request a service to a designated remote server, the user must know which remote node the request will be sent to. To do this, a service name must be configured in the Tmax environment file, and the service name must be set in the remote node information of the SRLGW environment file. When SRLGW receives a service request, it sends the data to the remote node using the registered service name. For more information about Tmax environment settings, refer to Environment Configuration.

2. Service Types

2.1. Service Requests Initiated by Tmax

When SRLGW receives a service request from a Tmax client or service, it sends the request to the remote node. The service requests initiated by Tmax can be processed in two ways, NOREPLAY service call and REPLY service call. A NOREPLY service call sends a service request to the remote node and does not receive a response. A REPLY service call sends a service request and regards the response as a new service request.

NOREPLY Service Call

When the service, which has received a service request from a Tmax client, sends a tpcall to SRLGW, SRLGW sends the service request to the remote node and returns immediately without waiting for a response. When SRLGW is operates in this way, the Tmax service which the Tmax client has requested continues to receive other requests without waiting for a response from SRLGW.

The following is how SRLGW operates in the NOREPLY mode.

figure 2 1
SRLGW Operation in the NOREPLY Mode
  1. SRLGW and the remote node are in the connected state.

  2. A Tmax client sends a tpcall to the Tmax service.

  3. The Tmax service receives the client request, and sends a tpcall to SRLGW. The user must specify the service name of the serial port, which is connected to the remote node, that will process the service request.

  4. SRLGW makes a request to the remote node connected to the user-specified service.

  5. SRLGW sends a reply (tpreturn) to the initiator service.

REPLY Service Call

The remote node receives a service request, and calls another service to process the result. When a new service is called, the service processing result may be returned or not depending on the flags setting of the ComSend function. This option is used to separate the initiator service from the one that processes the result.

The following is how SRLGW operates in the REPLY mode. Tmax is configured not to receive the service processing result.

figure 2 2
SRLGW Operation in the REPLY
  1. SRLGW and the remote node are in the connected state.

  2. A Tmax client sends a tpcall to the Tmax service.

  3. The Tmax service receives the client request, and sends a tpcall to SRLGW. The user must specify the service name of the serial port, which is connected to the remote node, that will process the service request.

  4. SRLGW makes a request to the remote node connected to the user-specified service.

  5. SRLGW sends a reply (tpreturn) to the initiator service.

  6. SRLGW receives a result service call from the remote node.

  7. SRLGW calls the user-specified service.

2.2. Service Requests Initiated by Remote Node

Service requests initiated by a remote node can be processed either synchronously or asynchronously. In the synchronous mode, SRLGW initiates a service call and waits for the response. In the asynchronous mode, SRLGW initiates a service call but does not wait for the response. In the synchronous mode, another service call that comes in during a service request before receiving the response must be handled properly.

Synchronous Mode

In the synchronous mode, a service call is initiated from a remote node and SRLGW receives the result to send it to the channel that has requested the service. The number of calls which the remote node can simultaneously initiate cannot exceed the MAXSACALL setting in the Tmax environment file.

A user initiates a call from the remote node to SRLGW and receives a response using the COM library. Users on the remote node must not set any flags when calling ComSend.

The remote synchronous call is the most universal method of calling a Tmax service from the remote node. SRLGW stores the remote node’s channel information and it finds the applicable channel among the channels it has and sends the result when it receives results from the service. Since the remote node’s channel is not blocked, SRLGW must handle other requests that come into the channel before the results are returned to the channel.

The following is how SRLGW operates in the synchronous mode.

figure 2 3
SRLGW Operation in the Synchronous Mode
  1. SRLGW and the remote node are in the connected state.

  2. A remote node sends a message to the channel connected to the SRLGW.

  3. SRLGW calls the Tmax service using tpacall().

  4. SRLGW receives the service processing result and then locates the channel of the initiating service.

  5. If the channel is properly connected to the remote node, then SRLGW sends the result.

Asynchronous Mode

In the asynchronous mode, a service call is initiated from a remote node and SRLGW does not wait for a response from the service that processed the request.

To use the asynchronous mode, the remote node must set COMMNOREPLY in the flags when calling ComSend. When COMMNOREPLY is set, SRLGW initiates a call to the Tmax service but does not receive a response.

The following is how SRLGW operates in the asynchronous mode.

figure 2 4
SRLGW Operation in the Asynchronous Mode
  1. SRLGW and the remote node are in the connected state.

  2. Remote node sends a message to the channel connected to the SRLGW.

  3. SRLGW calls the Tmax service using tpacall().

  4. SRLGW returns the processing result.