Open shaileshsaxena1011 opened 5 months ago
My requirement is to connect multiple simultaneous connections to the same PLC. Below is my code snippet:
import 'package:modbus/modbus.dart' as modbus; main(List arguments) async { var client = modbus.createTcpClient( '192.168.250.40', port: 502, mode: modbus.ModbusMode.rtu, ); try { await client.connect(); client.setUnitId(100); client.readHoldingReg(301,1) } finally { client.close(); } }
I can connect a single client to the PLC but when I connect the second client to PLC I get a connection refused error.
I would greatly appreciate it if you could help me out here. I have a strict client deadline to meet
Thanks
My requirement is to connect multiple simultaneous connections to the same PLC. Below is my code snippet:
import 'package:modbus/modbus.dart' as modbus; main(List arguments) async {
var client = modbus.createTcpClient(
'192.168.250.40',
port: 502,
mode: modbus.ModbusMode.rtu,
);
try {
await client.connect();
client.setUnitId(100);
client.readHoldingReg(301,1)
} finally {
client.close();
}
}
I can connect a single client to the PLC but when I connect the second client to PLC I get a connection refused error.
I would greatly appreciate it if you could help me out here. I have a strict client deadline to meet
Thanks