MangoAutomation/modbus4j

创建 createTcpListener 如何让多个从站跟你建立连接

Zhao-ChengHu opened this issue · 1 comments

public ModbusTCPClient(String host, int port) throws ModbusInitException {
    IpParameters params = new IpParameters();
    params.setHost(host);
    params.setPort(port);
    params.setEncapsulated(false);
    this.rtuMaster = modbusFactory.createTcpListener(params);
    //设置超时时间
    this.rtuMaster.setTimeout(2000);
    //设置重连次数
    this.rtuMaster.setRetries(3);
    //初始化
    this.rtuMaster.init();
}

解决了,我重写了你的TcpListener类