Using random ports in TCP
By default, TCP picks the port defined by start_port (default=7800). If that port is in use, the next port (7801) will be tried and so on, until a free port is found.
Sometimes, fixed ports are not desired, e.g. because of issues with reincarnation (http://jira.jboss.com/jira/browse/JGRP-130) or problems with the TIME_WAIT state of TCP (TCP lingering).
We can switch TCP or TCP_NIO to use random ports by (a) setting start_port="0" and (b) using either MPING (requires IP multicast) or TCPGOSSIP:
<TCP linger="500" bind_addr="192.168.5.2" start_port="0" loopback="true" send_buf_size="100000" recv_buf_size="200000"></TCP> <MPING timeout="3000" num_initial_members="3"></MPING> ...
Note that random ports cannot be used if TCPPING is used because TCPPING requires a list of fixed addresses/ports to ping for discovery.
Comments