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

Connecting the Modbus #3

Open
hammadtq opened this issue Sep 18, 2016 · 0 comments
Open

Connecting the Modbus #3

hammadtq opened this issue Sep 18, 2016 · 0 comments

Comments

@hammadtq
Copy link

hammadtq commented Sep 18, 2016

Hi,

I found an error and struggled with it for a while.

When we acquire a new client via:

var client = new ModbusClient()

The function in modbus.js has:

`ModbusClient = function (timeout, autoreconnect) {

    if (!(this instanceof ModbusClient))
        return new ModbusClient(timeout, autoreconnect);

    // needed for the inheritance
    StateMachine.call(this, 'init');

    var host            = 'localhost',
        port            = 502,
        id              = 0,`

While again, after acquiring the client I am giving host and port:

client.connect(host, port);

After much struggle, I found out that above 'localhost' is creating all the problem. If I change it to the IP address then it works fine. However, I am not sure why library is using an IP there and then also using a different connection function. Can you please have a look?

Great work by the way!

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