Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
465 stars 174 forks source link

Modbus server response handler has a minor bug #220

Closed alex-controlx closed 5 years ago

alex-controlx commented 5 years ago

src/modbus-server-response-handler.js at line 241 has "IF" statement which is always false. responseBody doesn't have property address.

I guess class WriteMultipleRegistersResponseBody needs to be modified to get address property or in the "IF" statement it needs to be property start.

Or even it should be: if (responseBody.start * 2 + request.body.values.length > this._server.holding.length) { ...

Is it correct?

stefanpoeter commented 5 years ago

Hi @Alex-OPTIM

This must actually be the address from the request body. So it must look something like this requestBody.address * 2 + ... length ... > ... length

so you are partially right. Thanks for the hint, I'll prepare a pull request.

stefanpoeter commented 5 years ago

Thanks for your help.