Closed sthelen-enqs closed 8 months ago
We do check the length of the packet, but when a frame is split the each dap have it own length.
This seems to be bug in our transport layer, I will take a look later.
Thanks for a very complete documentation, that helps a lot isolating the bug. I will use the data to create a specific test case, and then solve it.
As a workaround while I work, you could consider trying the sync client, that is another implementation and might allow you to continue working.
Thank you very much for the quick fix, I can confirm that the async client now works with this device on latest dev.
The sync client also worked in the interim yesterday, thanks for the suggestion.
Versions
Pymodbus Specific
Description
When trying to read registers from the SMA STP 6000TL Inverter, the Modbus Response is split over 2 frames where the second frame only contains the last required byte. pymodbus doesn't seem to reassemble the modbus frames and instead tries parsing the first frame as a modbus response which it discards because it doesn't pass the Frame check. It then tries reading the second frame (consisting of only one byte) as a response and throws an exception because it can't decode it.
pymodbus should probably check the length of the tcp packet and only run the frame check once the complete packet has arrived. I've attached the client code, pymodbus logs and a wireshark capture of the modbus traffic.
Code and Logs
20240104_tcp_reassembly.pcapng.gz
Logs: