goburrow / modbus

Fault-tolerant implementation of modbus protocol in Go (golang)
BSD 3-Clause "New" or "Revised" License
936 stars 366 forks source link

Added a receive flush timeout just prior to launching the next poll when #65

Open wz2b opened 4 years ago

wz2b commented 4 years ago

using a TCP connection. Without this, a slow response can cause transaction ID mismatches for the life of this TCP connection (it never recovers). This occurs when a remote device does answer, but it answers too slowly. The request has already timed out, and when the next request is launched the previous response is read (rather than the new one) causing this error.

HarryChen001 commented 3 years ago

hi,i think you should change the SetReadDeadline(time.now) to SetReadDeadline(time.now().add(time.millisecod*1))