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 ( 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="" start_port="0" loopback="true" send_buf_size="100000" 
        <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.