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

ReadHoldingRegistersAsync() does not work properly #104

Open
MichaelHoffmeisterFesto opened this issue Jan 8, 2024 · 1 comment
Open

Comments

@MichaelHoffmeisterFesto
Copy link

MichaelHoffmeisterFesto commented Jan 8, 2024

Hello,
I have a code working with the synchronous version of your lib very fine.
E.g.:

byte[] id = (Client.ReadHoldingRegisters<byte>(99, address, 2 * quantity)).ToArray();

for address == 1, quantity == 2 is returning good values.
When I start the async version of the call, the awaiter is blocking. Only when I am stopping the connection, I get exceptions that the function code was not correct and the call is return e.g. 17 bytes.
Any ideas?
Best,
Michael

@Apollo3zehn
Copy link
Owner

This should not happen of course but it is difficult to tell what the reason could be. The async code is very similar to the synchronous one. In fact it is being autogenerated by taking the synchronous code and modifying it slightly to prepare it for async operation: https://github.com/Apollo3zehn/FluentModbus/blob/master/src/FluentModbus/Client/ModbusTcpClientAsync.tt

In any case this lib should be easy to debug as nothing fancy is happening internally.

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

2 participants