hacker-cb / modbus-dart

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

Error when Modbus TCP Datagrams are fragmented in multiple TCP frames #22

Closed klaasdannen closed 1 year ago

klaasdannen commented 2 years ago

Our Modbus TCP device sometimes sends MB header and MB payload in separate TCP frames. Your implementation only works when all the data is in a single TCP frame. The problem is that you don't have a real buffer but only get the data from the socket in the _onData method and expect that a full Modbus frame is present.

Adding a proper TCP buffer handling with handover of unprocessed ByteData would improve the reliability of the library a lot!