主機(客戶端)
引用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);