Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
456 stars 169 forks source link

Mistake in Readme.md #262

Closed anxorl closed 4 years ago

anxorl commented 4 years ago

In section 'Server example' same variable is used as net.Server object and modbus.server.TCP object.

So, in the last line, when listen function is called, this code fail because it is an unknown function of modbus.server.TCP as it is a net.Server function.

Regards

jacobq commented 4 years ago

Yeah, trying to run this via copy/paste results in something like this:

const server = new modbus.server.TCP(server)
      ^

SyntaxError: Identifier 'server' has already been declared
    at wrapSafe (internal/modules/cjs/loader.js:1047:16)
    at Module._compile (internal/modules/cjs/loader.js:1097:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47
stefanpoeter commented 4 years ago

See the latest versions on branch v3.1 and branch v4.0.