Environment Configuration
This chapter describes the environment configuration of SRLGW.
1. Overview
To configure an SRLGW server, the following files must exist. The files (SRLGW and library) are created in each directory when Tmax SRLGW is installed.
The environment files used vary depending on the operating system.
-
UNIX
Directory File Name Lib
tmaxcom.a, tmaxcom.so
Lib64
tmaxcom.a, tmaxcom.so
appbin
serialgw
-
Windows
Directory File Name Lib
tmaxcom.lib, tmaxcom.dll
bin
serialgw.exe
Currently, SRLGW only runs in Windows. The UNIX system will be supported in the next version. |
2. Tmax Environment Configuration
To use SRLGW, SRLGW must be configured as a server in the Tmax environment file. Configuration is similar to the USC server among Tmax servers except that SVRTYPE is CUSTOM_GATEWAY instead of UCS. For SRLGW, only the SERVER and SERVICE sections have to be configured.
The following is an example of a Tmax environment file.
*DOMAIN tmax SHMKEY = 88000, MINCLH = 1, MAXCLH = 1, TPORTNO = 8800 *NODE tmax1 TMAXDIR = "/home/tmax", APPDIR = "/home/tmax/appbin" *SVRGROUP svg1 NODENAME = tmax1 *SERVER serialgw SVGNAME = svg1, MIN = 1, MAX = 1, CPC = 10, SVRTYPE = CUSTOM_GATEWAY, CLOPT = "-- -F /home/tmax/config/serlal.cfg -w 5050" *SERVICE COM1 SVRNAME = serialgw COM2 SVRNAME = serialgw
Item | Description |
---|---|
MIN |
Number of SRLGW processes. It must always be set to 1. |
CPC |
Number of channels between the Tmax engine and SRLGW. When a Tmax client initiates a service call to the remote node, the CPC count must be set to the number of concurrent requests. When the remote node initiates the call, SRLGW makes a request to the Tmax engine through tpacall which does not require as many channels. |
CLOPT |
Refer to CLOPT Entry (SRLGW Option). |
SVCTIME |
SRLGW does not apply the service timeout for services requested to the remote node. A service is requested to the remote node and the reply is processed through a separate service and so the service timeout is not used. |
CLOPT Entry (SRLGW Option)
Since the items that can be registered in the Tmax configuration file for SRLGW are limited, some options must be set in the CLOPT entry.
The following describes each option that affects the operation of SRLGW and must be clearly understood.
Option | Description |
---|---|
[-F] |
File with the serial port and service name information that SRLGW uses to find the remote node. SRLGW uses the file information specified in this option to connect to the remote node. The file can also be used to find the remote node through the service name specified by a Tmax service or client. For information on how to register the file, refer to SRLGW Environment File. |
[-w] |
In SRLGW, one thread handles one port. Each thread uses one socket to send data to the main thread. This option specifies the port number used by each thread to send data to the main thread. (default value: 8880) |
[-q] |
When a Tmax service is requested from the remote node, deferred processing can be used. That is, temporary data are stored in the RQ on Tmax and then batch processed later. This option is used to configure the RQ name. |
[-A] |
Option to send/receive ACK/NAK messages during data transmission between SRLGW and the remote node. Tmax SRLGW internally processes ACK/NAK messages, but the COM library of the remote node doesn’t process ACK/NAK messages. Therefore, the user program must process them. (default value: does not send/receive ACK/NAK) |
[-t] |
Timeout to wait for an ACK message from the remote node. If SRLGW does not receive an ACK/NAK within this time, SRLGW is considered to have received an ACK message. (default value: Infinite) |
2.1. ACK/NAK Messages
The following is the SRLGW environment configuration for receiving ACK/NAK messages.
*DOMAIN ... *NODE ... *SVRGROUP ... *SERVER serialgw SVGNAME = svg1, MIN = 1, MAX = 1, CPC = 10, SVRTYPE = CUSTOM_GATEWAY, CLOPT = "-- -F /home/tmax/config/serlal.cfg –w 5555 –A" *SERVICE COM1 SVRNAME = serialgw
When the environment file is created as in the previous example, an SRLGW named serialgw starts when Tmax starts up. The service name of serialgw is COM1. SRLGW must send/receive ACK/NAK messages when it is sending/receiving data to/from the remote node. Therefore, ACK/NAK messages must be taken into account when developing a program on the remote node.
2.2. Deferred Processing
The following is the environment configuration for using deferred processing through RQ in SRLGW.
*DOMAIN ... *NODE ... *SVRGROUP ... *SERVER serialgw SVGNAME = svg1, MIN = 1, MAX = 1, CPC = 10, SVRTYPE = CUSTOM_GATEWAY, CLOPT = "-- -F /home/tmax/config/serlal.cfg –w 5555 –q testq" *SERVICE COM1 SVRNAME = serialgw
When the environment file is created as in this example and service is requested from the remote node to Tmax using the COM library (set COMMDELAY in flags), then SRLGW stores the requested data in "testq".
Since SRLGW only stores the data from the remote node in RQ, the user program must process the data stored in RQ.
3. SRLGW Environment File
The file specified with the [-F] option in the CLOPT entry of the Tmax environment file must be registered in the format described in the following.
3.1. Address Information File
This file contains the serial port information of the remote node. The port information must be the same as the one used on the remote node.
Since SRLGW allocates as many threads as configured in the environment file, all serial ports of the remote node must be configured. A remote node that is not configured in the following file cannot communicate with SRLGW.
####################################################### # gwno baudrate stopbit Parity Byte Port Tmaxsvc # 0 9600 1 ODD 8 COM1 SVC ####################################################### # line start with "#" is comment line # gwno must start at 0 and be increased by 1 # stopbit: 1, 1.5, 2 # parity : NONE, ODD, EVEN # byte: 5, 6, 7, 8 # port: serial port name # svc: tmax service name ####################################################### 0 9600 1 NONE 8 COM1 SVC1 0 9600 1 NONE 8 COM2 SVC2
The following describes each item of the address information file.
Item | Description |
---|---|
gwno |
Used only when the MIN value of the Tmax environment file is 2 or greater. Since the MIN value is always 1, this item must always be set to 0. |
baudrate |
Communication rate between remote node and SRLGW. |
stopbit |
Stop bit count used in serial communication. The options are as follows:
|
Parity |
Parity value. The options are as follows:
|
Byte |
Number of bits that make up a single byte. The options are 5, 6, 7 or 8. |
Port |
Name of the port that is connected to the remote node. The port must be physically connected to the remote node. |
Tmaxsvc |
When a Tmax client or service initiates a service request to a specific remote node, SRLGW must be informed of the remote node information. If SRLGW is called with the service name specified in this option, SRLGW finds the remote node and send data to the remote node. The service name specified here must be a service name configured in the SERVICE section of the Tmax environment file. SRLGW can find the remote node either by using the service name as previously described, or by specifying the remote node name when making a connection from the remote node to SRLGW. In the latter method, the specified remote name must be configured in the SERVICE section of the Tmax environment file. |