Skip to content

rtu.send_message should not read more bytes than needed. #49

Closed

Description

@OrangeTux

Currrently rtu.send_message() is to greedy when reading response from the serial port. uModbus will fail when a server appends a response with for example a few nul bytes. The function should not read more bytes than needed.

Often the length of the response can be calculated. For response on function codes 1, 2, 3, 4,15 and 16 the 2nd byte of the PDU contains the byte count. That is how many bytes are left in the PDU.

The response of function code 5 en 6 is of the same length as the request PDU.

In case of an error the response is only 2 bytes.

Activity

  1. added a commit that references this issue on May 17, 2018
    bbc8069
  2. added a commit that references this issue on May 22, 2018
    96cbb94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions