Receiving on TCP

Receiving channel programs are started in response to a startup request from the sending channel. To respond to the startup request, 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.

We can start more than one listener for each queue manager. By default, the STRMQMLSR command uses port 1414 but we can override this value. 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 we 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 we use the STRMQMLSR command, the listener defaults to the new port.

Alternatively, we 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.


Use the TCP SO_KEEPALIVE option

If you want to use the SO_KEEPALIVE option (for more information, see Checking that the other end of the channel is still available ) you must 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). We can now specify a time interval in minutes. We can specify a value in the range 1 through 40320 minutes; the default is 120.


Use the TCP listener backlog option

When receiving on TCP, a maximum number of outstanding connection requests is set. This number 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 IBM® i is 255. If the backlog reaches this value, the TCP connection is rejected and the channel is not 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 can retry the connection at a later time.

However, to avoid this error, we 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 value can be used to avoid reaching the connection limit.