Cloud-Automation / node-modbus

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

RTU Server? #201

Closed martijnthe closed 6 years ago

martijnthe commented 6 years ago

hi Stefan,

Looking at the code, RTU server is not supported today, correct?

Do you have some thoughts on how to restructure the code to add support for it?

I started reading through the code a bit. My notes so far:

stefanpoeter commented 6 years ago

It shouldn't be that hard. Just create a modbus-rtu-server.js and handle everything like it is done in the modbus TCP server. You need an RTU request handler and also, like you said, a createPayload method in the RTUResponse.

If I remember correctly than there is no handshake in RTU so you don't need to remember new clients.

martijnthe commented 6 years ago

PR: https://github.com/Cloud-Automation/node-modbus/pull/204