hacker-cb / modbus-dart

BSD 3-Clause "New" or "Revised" License
37 stars 22 forks source link

Unable to connect multiple clients to the same PLC simultaneously #33

Open shaileshsaxena1011 opened 5 months ago

shaileshsaxena1011 commented 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