Specifying a range of ports for client connections

 

When a WebSphere MQ base Java application attempts to connect to a WebSphere MQ queue manager in client mode, a firewall might allow only those connections that originate from specified ports or range of ports. In this situation, we can specify a port, or a range of points, that the application can bind to. We can do this in either of the following ways:

In each of these examples, when the application connects to a queue manager subsequently, the application binds to a local IP address and port number in the range 9.20.0.1(2000) to 9.20.0.1(3000).

In a system with more than one network interface, we can also use the localAddressSetting field, or the environment property MQC.LOCAL_ADDRESS_PROPERTY, to specify which network interface must be used for a connection.

Connection errors might occur if you restrict the range of ports. If an error occurs, an MQException is thrown containing the WebSphere MQ reason code MQRC_Q_MGR_NOT_AVAILABLE and the following message:

Socket connection attempt refused due to LOCAL_ADDRESS_PROPERTY restrictions
An error might occur if all the ports in the specified range are in use, or if the specified IP address, host name, or port number is not valid (a negative port number, for example).


uj11110_