rossmann-engineering / EasyModbusTCP.NET

Modbus TCP, Modbus UDP and Modbus RTU client/server library for .NET implementations
928 stars 402 forks source link

ReadCoils method always returns true when EasyModbusServer disconnects #12

Closed kv1dr closed 5 years ago

kv1dr commented 6 years ago

Running ReadColis method on ModbusClient returns correct value, but when the ModbusSever disconnects, ReadCoils starts returning true.

EasyModbus library version: 5.0 (problem exists also on 4.4)

Steps I have tried:

  1. Using EasyModbus library on C# project I am calling ReadCoils(1,1)[0] every second
  2. I run EasyModbusTCP Server Simulator
  3. EasyModbus library connects to simulator and starts returning correct value
  4. I close the simulator

What happens:

  1. ReadCoils(1,1)[0] method starts returning true as, even if the previous value was false (when it was connected)
  2. Connected property of ModbusClient object is true for next second or two even when next exception is raised: System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.

What should happen:

  1. ReadCoils should raise exception or at least return previous value, when server disconnects
rossmann-engineering commented 5 years ago

I wasn't able to reproduce that problem. As soon as I close the Simulator I get a Timeout Excetion