Commit 8ed1fcc
Backport robustness improvements from python-s7comm
Backports concrete robustness improvements from nikteliy/python-s7comm
to the native Python S7 implementation:
- 210+ S7 protocol error codes from Wireshark's S7 dissector covering
USERDATA parameter errors (0xD0xx), protocol errors (0x8xxx), and
resource errors. parse_response() now raises descriptive S7ProtocolError
on header errors, and USERDATA response parsing logs warnings.
- Stale packet detection with retry: new validate_pdu_reference()
validates response sequence numbers. New _send_receive() helper wraps
the send/receive/parse pattern with automatic retry on stale packets
(up to 3 retries). Refactored ~15 call sites in client.py to use it.
- Automatic PDU splitting for read_area()/write_area(): requests
exceeding the negotiated PDU length are automatically chunked,
preventing PLC rejections on large reads (e.g. db_get() on big DBs).
- TPDUSize enum (ISO 8073) with configurable COTP negotiation: replaces
hardcoded 0x0A with a proper IntEnum (128-8192 bytes).
- MAX_VARS=20 limit on read_multi_vars()/write_multi_vars(): raises
ValueError when exceeding the S7 protocol limit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 68af88d commit 8ed1fcc
7 files changed
Lines changed: 859 additions & 250 deletions
File renamed without changes.
0 commit comments