Subject: | write_multiple_registers() generates a malformed request when sending more than 123 registers |
Date: | Wed, 2 Aug 2017 15:06:49 +0000 (UTC) |
To: | "bug-Device-Modbus-TCP [...] rt.cpan.org" <bug-Device-Modbus-TCP [...] rt.cpan.org> |
From: | "R. Diez" <rdiezmail-perl [...] yahoo.de> |
Hi there:
With Modbus TCP, you can only write up to 123 registers at once with write_multiple_registers(). This limit is imposed by the Modbus TCP protocol.
However, if you try to send more registers, module Device::Modbus::TCP just sends a malformed request. I think the upper bit gets set, which means that an exception code is sent as a Modbus request. The server rejects it accordingly.
I think the client should check and throw an exception (with "die") to the caller instead of sending a malformed request.
Other than that, many thanks for the module!
Best regards,
rdiez