-
Notifications
You must be signed in to change notification settings - Fork 76
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
fix two modbus rtu problems #79
Conversation
Added a new commit, which adds a virtual stop method to the ModbusServer base class. This helps to add both servers in the same container and perform cleanup on them. |
Thank you! I will go through it next week as I need to finish another project right now. |
You wrote "Therefor the InBuffer of SerialPort should be cleared even if the serialport is already closed." but your PR does the opposite: Is clears the buffer only when the serial port is already closed. I am a little bit confused. What happens if the serial port is already closed and we try to clear the buffer? Will it throw an exception? Edit: I have tested it and it throws an exception. So I agree to this change (only discarding buffer when port is open). |
Where does the exception occur, if the |
I have removed the Line |
When a ModbusRtuRequestHandler is Disposed it closes the SerialPort before the CancellationTokenSource of the base class is cancelled. Therefor the InBuffer of SerialPort should be cleared even if the serialport is already closed.
Secondly on a timeout exception the UnitIdentifier should be reset otherwise an exception is thrown.