private void setSocket(Socket socket, boolean useRtuOverTcp) throws IOException {
        this.socket = socket;

        if (transport == null) {
            if (useRtuOverTcp) {
                logger.trace("setSocket() -> using RTU over TCP transport.");
                transport = new ModbusRTUTCPTransport(socket);
            }
            else {
                logger.trace("setSocket() -> using standard TCP transport.");
                transport = new ModbusTCPTransport(socket);
            }
        }
        else {
            transport.setSocket(socket);
        }

        connected = true;
    }
private void setSocket ( Socket socket , boolean useRtuOverTcp ) throws IOException { this . socket = socket ; if ( transport == null ) { if ( useRtuOverTcp ) { logger . trace ( "setSocket() -> using RTU over TCP transport." ) ; transport = new ModbusRTUTCPTransport ( socket ) ; } else { logger . trace ( "setSocket() -> using standard TCP transport." ) ; transport = new ModbusTCPTransport ( socket ) ; } } else { transport . setSocket ( socket ) ; } connected = true ; }
Prepares the associated <tt>ModbusTransport</tt> of this
<tt>TCPMasterConnection</tt> for use.

@param socket        the socket to be used for communication.
@param useRtuOverTcp True if the RTU protocol should be used over TCP
@throws IOException if an I/O related error occurs.