Skip to content

ReadFileRecordResponse <calculateRtuFrameSize> calculates invalid size #3

@bashwork

Description

@bashwork

Working on current SVN trunk, Revision r176
Code to reproduce:

records = []
records.append(FileRecord(file_number=26, record_number=0, record_length=1))
request = ReadFileRecordRequest(records)
request.unit_id = 4

    rq = c.client.execute(request)

Problem:

  • When calculating the response frame, the function ReadFileRecordResponse.calculateRtuFrameSize will have the whole frame as argument in including address and function code.

If changed from
byte_count = struct.unpack('B', buffer[0])[0]
to
byte_count = struct.unpack('B', buffer[2])[0] + 5
the function starts to work correctly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions