Skip to content

Connect to targetAmsNetId on OSX Catalina fails #51

@hansipete

Description

@hansipete

Hello there,

first of all – thank you for that awesome library.

I'm using it to talk a Beckhoff PLC and it works like a charm. On one of my computers I run into a problem. Even the minimal example would not connect:

const ads = require('ads-client')

const client = new ads.Client({
  targetAmsNetId: '5.85.243.162.1.1',
  targetAdsPort: 851,
})

client.connect()
  .then(res => {   
    console.log(`Connected to the ${res.targetAmsNetId}`)
    console.log(`Router assigned us AmsNetId ${res.localAmsNetId} and port ${res.localAdsPort}`)

    return client.disconnect()
  })
  .then(() => {
    console.log('Disconnected')
  })
  .catch(err => {
    console.log('Something failed:', err)
  })

Results in this error message:
Something failed: ClientException: Connection to localhost:48898 failed (socket error -61) (connect ECONNREFUSED 127.0.0.1:48898)

(OSX Catalina, internal Firewall is turned OFF, no virus scanners etc.)

I wonder, why this tries to connect to localhost instead of the NetId. Is this expected behaviour? On the other machine (Windows) it connects just fine, printing:

Connected to the 5.85.243.162.1.1
PLC Router assigned us AmsNetId 169.254.105.221.1.1 and port 40334

Thanks in advance
Hans

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions