Defining a TCP connection on Windows
Define a TCP connection by configuring a channel at the sending end to specify the address of the target, and by running a listener program at the receiving end.
Before starting
A message channel using TCP/IP can be pointed at an IBM Aspera fasp.io Gateway, which provides a fast TCP/IP tunnel that can significantly increase network throughput. A queue manager running on any entitled platform can connect through an Aspera gateway. The gateway itself is deployed on Red Hat or Ubuntu Linux, or Windows. See Defining an Aspera gateway connection on Linux or Windows.
Send end
Specify the host name, or the TCP address of the target machine, in the Connection name field of the channel definition.
The port to connect to defaults to 1414. Port number 1414 is assigned by the Internet Assigned Numbers Authority to IBM MQ.
To use a port number other than the default, specify it in the connection name field of the channel object definition thus:DEFINE CHANNEL('channel name') CHLTYPE(SDR) + TRPTYPE(TCP) + CONNAME('OS2ROG3(1822)') + XMITQ('XMitQ name') + REPLACEwhere OS2ROG3 is the DNS name of the remote queue manager and 1822 is the port required. (This must be the port that the listener at the receiving end is listening on.)
A running channel must be stopped and restarted to pick up any change to the channel object definition.
We can change the default port number by specifying it in the .ini file for IBM MQ for Windows:TCP: Port=1822Note: To select which TCP/IP port number to use, IBM MQ uses the first port number it finds in the following sequence:
- The port number explicitly specified in the channel definition or command line. This number allows the default port number to be overridden for a channel.
- The port attribute specified in the TCP stanza of the .ini file. This number allows the default port number to be overridden for a queue manager.
- The default value of 1414. This is the number assigned to IBM MQ by the Internet Assigned Numbers Authority for both inbound and outbound connections.
For more information about the values you set using qm.ini, see Configuration file stanzas for distributed queuing.
Receive on TCP
To start a receiving channel program, a listener program must be started to detect incoming network requests and start the associated channel. We can use the IBM MQ listener.
Receive channel programs are started in response to a startup request from the sending channel.
To start a receiving channel program, a listener program must be started to detect incoming network requests and start the associated channel. We can use the IBM MQ listener.
To run the Listener supplied with IBM MQ, that starts new channels as threads, use the runmqlsr command.
A basic example of using the runmqlsr command:runmqlsr -t tcp [-m QMNAME] [-p 1822]The square brackets indicate optional parameters; QMNAME is not required for the default queue manager, and the port number is not required if we are using the default (1414). The port number must not exceed 65535. Note: To select which TCP/IP port number to use, IBM MQ uses the first port number it finds in the following sequence:
- The port number explicitly specified in the channel definition or command line. This number allows the default port number to be overridden for a channel.
- The port attribute specified in the TCP stanza of the .ini file. This number allows the default port number to be overridden for a queue manager.
- The default value of 1414. This is the number assigned to IBM MQ by the Internet Assigned Numbers Authority for both inbound and outbound connections.
For the best performance, run the IBM MQ listener as a trusted application as described in Running channels and listeners as trusted applications. See Restrictions for trusted applications for information about trusted applications
Use the TCP/IP SO_KEEPALIVE option
To use the Windows SO_KEEPALIVE option we must add the following entry to your registry:TCP: KeepAlive=yes
For more information about the SO_KEEPALIVE option, see Check that the other end of the channel is still available.
On Windows, the HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters registry value for the Windows KeepAliveTime option controls the interval that elapses before the connection is checked. The default is two hours.
Parent topic: Set up communication on Windows