setLocalAddress

 

public void setLocalAddress(String address) throws JMSException;

Sets the local address.

Parameters

  • address - the local address to be used. The format of a local address is [ip-addr][(low-port[,high-port])]. Here are some examples:

    9.20.4.98

    The channel binds to address 9.20.4.98 locally.

    9.20.4.98(1000)

    The channel binds to address 9.20.4.98 locally and uses port 1000.

    9.20.4.98(1000,2000)

    The channel binds to address 9.20.4.98 locally and uses a port in the range 1000 to 2000.

    (1000)

    The channel binds to port 1000 locally.

    (1000,2000)

    The channel binds to a port in the range 1000 to 2000 locally.

    We can specify a host name instead of an IP address.

    Specify a range of ports to allow for connections that are required internally as well as those explicitly used by an application. The number of ports required depends on the application and the facilities it uses. Typically, this is the number of sessions the application uses plus three or four additional ports. If an application is having difficulty making connections, increase the number of ports in the range.

    Note that connection pooling has an effect on how quickly a port can be reused. In JMS, connection pooling is switched on by default and it might be some minutes before a port can be reused Connection errors might occur in the meantime.

    For direct connections, the local address determines which of the local network interfaces is used for multicast connections. When specifying a local address for a direct connection, do not include a port number. A port number is not valid for multicast and, if specified, causes a failure at connect time.

Exceptions

  • JMSException - if the format of the local address is incorrect.


uj28490_