modbus-dart icon indicating copy to clipboard operation
modbus-dart copied to clipboard

How to set Response timeout?

Open nancyyihao opened this issue 1 year ago • 1 comments

I want to set a timeout if modbus slave not response in a given time(like 2000ms), how can I do it ?

nancyyihao avatar Apr 10 '23 09:04 nancyyihao

With a simple solution you could do this

var coils = await _client.readCoils(1,1).timeout(Duration(miliseconds: 2000), onTimeout: () {
   //Do something
});

ElegantCrab avatar Apr 27 '23 19:04 ElegantCrab