NModbus4 TCP通訊

hardenzhao發表於2024-03-22

主機(客戶端)

引用NModbus

NModbus.IModbusMaster master;

TcpClient client = new TcpClient();

client = new TcpClient("127.0.0.1", 502);
factory = new ModbusFactory();
master = factory.CreateMaster(client);

引用NModbus4

using modbus.device;

TcpClient client = new TcpClient("127.0.0.1", 502);

client = new TcpClient();
client.Connect("127.0.0.1", 502);
master = ModbusIpMaster.CreateIp(client);

相關文章