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

getMultipleHoldingRegisters() in Modbus-TCP Server causes a failure when returning a Promise #572

Open
romor opened this issue Jan 9, 2025 · 0 comments

Comments

@romor
Copy link

romor commented Jan 9, 2025

According the TypeScript definitions, IServiceVector::getMultipleHoldingRegisters() support returning Promise<number[]>.

However, when this is used, the return length check in servertcp_handler.js::300 will always fail. The corresponding code part is:

        const values = vector.getMultipleHoldingRegisters(address, length, unitID);
        if (values.length === length) {

As values is Promise{[...]} its length check fails and this results in a Modbus exception sent to client instead of the provided read result.

When getMultipleHoldingRegisters() returns number[] directly, without a Promise, everything works as expected.

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