Open loonwong opened 4 years ago
Hi!
I guess, you are referring to this line, right?
This method would cause a single transmission error if the TickCount overflows exactly while waiting for data and I think any application resilient enough will keep working anyway. Honestly I use sharp7 in many application that runs in high frequency polling over many years and I didn't get any problem at this point.
I understand the problem, I will fix it. Thank you for your suggestion.
Best regards,
Federico
I don't think that this will cause an issue due to the way .net handles integer arithmetic.
Hello!
We are using an implementation for C# and I would like to draw your attention to the following code:
This is because Environment.TickCount returns values from Int32.MinValue to Int32.MaxValue. Therefore, if the system has been running for 24.9 days, the counter will turn negative and the expression Expired = Environment.TickCount-Elapsed > Timeout will return false for the next 24.9 days. Instead of Environment.TickCount, I would suggest using a static instance of Stopwatch (which is run once) to get uptime milliseconds.