Apollo3zehn / FluentModbus

Lightweight and fast client and server implementation of the Modbus protocol (TCP/RTU).
MIT License
204 stars 71 forks source link

Client: Make timeout configurable. #8

Closed Apollo3zehn closed 4 years ago

11v1 commented 4 years ago

Hello.

I need this tweak! ;-)

Apollo3zehn commented 4 years ago

Hi, I added two properties to allow specifying the connect timeout and the read timeout. You can use it like this (the snipped shows only the usage of ConnectTimeout but it works the same for ReadTimeout). The time is provided in milliseconds.

I uploaded a new NuGet package (https://www.nuget.org/packages/FluentModbus). I hope this works for you, if not please file a new issue.

Apollo3zehn commented 4 years ago

I published another release with the possiblity to specify a timeout for the server. After this timeout (default: 1 minute) client connections will be closed when no communication takes place. I found a bug that the server's timeout timer was never reset which caused the connection to be aborted after 1 minute. Unfortunately, this bug was not covered by the unit tests.

I released version 1.4.0 with the bug solved and a unit test added to prevent that this happens again.