modbus4j icon indicating copy to clipboard operation
modbus4j copied to clipboard

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

Open Zhao-ChengHu opened this issue 3 years ago • 2 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();
}

Zhao-ChengHu avatar Mar 02 '23 05:03 Zhao-ChengHu

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

Zhao-ChengHu avatar Mar 16 '23 15:03 Zhao-ChengHu