rossmann-engineering / EasyModbusTCP.NET

Modbus TCP, Modbus UDP and Modbus RTU client/server library for .NET implementations
922 stars 396 forks source link

Transaction identifier #56

Open vazquezbonilla opened 3 years ago

vazquezbonilla commented 3 years ago

Hi,

for each request, the code places a transactionIdentifierInternal (For synchronization between messages of server and client) which it then doesn't check in the responses

for example:

public int[] ReadHoldingRegisters(int startingAddress, int quantity) { . . . Byte[] data = new byte[]{ this.transactionIdentifier[1], this.transactionIdentifier[0], this.protocolIdentifier[1], this.protocolIdentifier[0], this.length[1], this.length[0], this.unitIdentifier, this.functionCode, this.startingAddress[1], this.startingAddress[0], this.quantity[1], this.quantity[0], this.crc[0], this.crc[1]

. . . }

I think it would be necessary to check that the Transaction identifier of the response matches that of the request, I am having problems with responses that are coming to me after timeouts and retries

regards