Skip to content

Async client: list_datablocks()/EXPLORE missing IntegrityId tail + fragment reassembly #7

@ale-rinaldi

Description

@ale-rinaldi

The sync S7CommPlusConnection got a working EXPLORE in gijzelaerr#749: the request uses integrity_tail=5 (UInt32 + filler) for the V2 IntegrityId splice, and the response is reassembled across multiple S7CommPlus PDUs (send_request(..., integrity_tail=5, reassemble=True)).

The async client (S7CommPlusAsyncClient) was given list_datablocks()/browse() experimentally in gijzelaerr#687, but its _send_request(function_code, payload) has no integrity_tail or reassemble support. Against a real S7-1500 this means:

  • list_datablocks() returns an empty list (the large EXPLORE response is never reassembled, and the request lacks the 5-byte trailer for the IntegrityId splice).
  • browse() is affected for the same reason.

Repro

Connect the async client over TLS to a real S7-1500 (V2). connect() + session setup succeed, but await client.list_datablocks() returns [], whereas the sync client returns the full DB list against the same PLC.

Fix

Bring the async _send_request to parity with the sync one:

  • add an integrity_tail parameter for the V2 IntegrityId splice (4 default, 5 for EXPLORE),
  • add an optional reassemble path that concatenates the multi-fragment response until the trailer (0x72 <ver> 0x0000), with the same size/fragment caps,
  • call it as _send_request(FunctionCode.EXPLORE, payload, integrity_tail=5, reassemble=True) from list_datablocks()/browse().

The sync implementation in s7/connection.py (send_request + _recv_reassembled_payload) is the reference; the PObject parser (_parse_explore_datablocks) is already shared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions