Defining a TCP connection

The channel definition contains a field, CONNECTION NAME, that contains either the TCP network address of the target, in dotted decimal form (for example 9.20.9.30) or the host name (for example AS4HUR1). If the CONNECTION NAME is a host name, a name server or the OS/400 host table is used to convert the host name into a TCP host address.

A port number is required for a complete TCP address; if this is not supplied, the default port number 1414 is used. On the initiating end of a connection (sender, requester, and server channel types) it is possible to provide an optional port number for the connection, for example:

Connection name 9.20.9.30 (1555)

In this case the initiating end will attempt to connect to a receiving program at port 1555.

 

Receiving on TCP

Receiving channel programs are started in response to a startup request from the sending channel. To do this, a listener program has to be started to detect incoming network requests and start the associated channel. You start this listener program with the STRMQMLSR command.

You can start more than one listener for each queue manager. By default, the STRMQMLSR command uses port 1414 but you can override this. To override the default setting, add the following statements to the qm.ini file of the selected queue manager (in this example, the listener is required to use port 2500):

   TCP:
     Port=2500

The qm.ini file is located in this IFS directory: /QIBM/UserData/mqm/qmgrs/queue manager name.

This new value is read only when the TCP listener is started. If you have a listener already running, this change is not be seen by that program. To use the new value, stop the listener and issue the STRMQMLSR command again. Now, whenever you use the STRMQMLSR command, the listener defaults to the new port.

Alternatively, you can specify a different port number on the STRMQMLSR command. For example:

STRMQMLSR MQMNAME(queue manager name) PORT(2500)

This change makes the listener default to the new port for the duration of the listener job.

 

Using the TCP SO_KEEPALIVE option

If you want to use the SO_KEEPALIVE option (as discussed in Checking that the other end of the channel is still available) add the following entry to your queue manager configuration file qm.ini(in the IFS directory, /QIBM/UserData/mqm/qmgrs/queue manager name):

TCP:
   KeepAlive=yes

You must then issue the following command:

CFGTCP

Select option 3 (Change TCP Attributes). You can now specify a time interval in minutes. You can specify a value in the range 1 through 40320 minutes; the default is 120.

 

Using the TCP listener backlog option

When receiving on TCP, a maximum number of outstanding connection requests is set. This can be considered a backlog of requests waiting on the TCP port for the listener to accept the request.

The default listener backlog value on OS/400 is 255. If the backlog reaches this value, the TCP connection is rejected and the channel will not be TCP: able to start.

For MCA channels, this results in the channel going into a RETRY state and retrying the connection at a later time.

For client connections, the client receives an MQRC_Q_MGR_NOT_AVAILABLE reason code from MQCONN and should retry the connection at a later time.

However, to avoid this error, you can add an entry in the qm.ini file:

ListenerBacklog = n

This overrides the default maximum number of outstanding requests (255) for the TCP listener.

Note:
Some operating systems support a larger value than the default. If necessary, this can be used to avoid reaching the connection limit.