Closed hansmaad closed 4 years ago
Hi @hansmaad,
i'll guess you are using jsmodbus v3? Seems like a valid request. If you prepare a pull request with the latest v3 version I'll check and merge it as soon as possible.
As it turned out... I'm currently on 4.0.0. But it doesn't seem to make a big difference regarding this issue...? What is the status of v4? Is it not really an official release?
v4 is an official release. You can patch it up there if you like.
I opened a pull request that I believe addresses the issue @hansmaad is observing. If this is the case, @stefanpoeter can you look over this and then bump the version to 4.0.1?
If @hansmaad gives his ok I sure will :-)
@stefanpoeter Looks good!
If I pass an open
SerialPort
toModbus.client.RTU
all requests will fail, because the request handler missed the open event.This happened to me the first time I tried to use jsmodbus. It's easy to workaround in normal cases but now I have the need to pass an open socket to multiple protocol handlers.
https://github.com/Cloud-Automation/node-modbus/blob/e57681a6e26990835533186d7baaeae143640f97/src/rtu-client-request-handler.js#L18-L25
Would it be possible to check
socket.isOpen
in the constructor to setthis._state = 'online'
?