Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the CRC fails, the system enters an infinite loop #83

Open
541728305 opened this issue Jul 24, 2022 · 0 comments
Open

When the CRC fails, the system enters an infinite loop #83

541728305 opened this issue Jul 24, 2022 · 0 comments

Comments

@541728305
Copy link

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); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant