When the CRC fails, the system enters an infinite loop
541728305 opened this issue · 0 comments
541728305 commented
When the slave machine continuously receives incorrect response and CRC check fails, the stack overflow will occur in an infinite loop
if (receivedUnitIdentifier != this.unitIdentifier) data = new byte[2100]; else countRetries = 0;
if ((crc[0] != data[data[8]+9] | crc[1] != data[data[8]+10])& dataReceived) { if (debug) StoreLogData.Instance.Store("CRCCheckFailedException Throwed", System.DateTime.Now); if (NumberOfRetries <= countRetries) { countRetries = 0; throw new EasyModbus.Exceptions.CRCCheckFailedException("Response CRC check failed"); } else { countRetries++; Console.WriteLine("countRetries:{0}", countRetries); return ReadHoldingRegisters(startingAddress, quantity); } }