A high-performance and ease-of-use implementation of the Modbus protocol written in Java. Supports ASCII, RTU, TCP, and UDP transports as slave or master, automatic request partitioning and response data type parsing.
GNU General Public License v3.0
897
stars
370
forks
source link
发送读写保持寄存器时会出现 Connection reset by peer: socket write error 。再次发送却成功了 #54
public static ModbusFactory modbusFactory = new ModbusFactory();
public static void readHoldingRegister(int slaveId, int offset, int dataType) throws Exception { BaseLocator locator = BaseLocator.holdingRegister(slaveId, offset, dataType);
Number value = getMaster().getValue(locator);
System.out.println("HoldingRegister寄存器第" + offset + "位数据为:" + value);
}