Skip to content

Transaction Identifier not checked in ModbusTcpClient, resulting in incorrect data #146

@LanderV-Vintecc

Description

@LanderV-Vintecc

The Transaction Identifier (the field identifying each modbus transaction) is ignored in ModbusTcpClient and ModbusTcpClientAsync:

_ = reader.ReadUInt16Reverse(); // 00-01 Transaction Identifier

_ = reader.ReadUInt16Reverse(); // 00-01 Transaction Identifier

According to the official docs, it is necessary to check it though: https://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf (page 10):

Several MODBUS transactions can be activated simultaneously on the same TCP Connection.
Remark: If this is done then the MODBUS transaction identifier must be used to uniquely identify the matching requests and responses.

A real-life example:

Image

A read request is written with transaction identifier 10.
The following message is a response with transaction identifier 0F.
Then, we get the response with transaction identifier 10.

Ignoring the transaction identifier will result in an incorrect value.

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