Skip to content

Add PDU size validation to write_area method #14

@nikteliy

Description

@nikteliy

Description

The write_area method in S7Comm sends data in a single request without checking if the request fits within the negotiated PDU size. If the data is too large, the PLC will reject the request or the behavior will be undefined.

Current Behavior

write_area creates a VariableWriteRequest and sends it without validating the total packet size against pdu_length.

Expected Behavior

Before sending, write_area should:

  1. Calculate the total request size (header + parameter + data)
  2. Compare against self.pdu_length
  3. Raise WriteDataTooLargeException (or similar) if request exceeds PDU size

additional context

Users should use write_area_multiple() for data exceeding PDU size

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions