Skip to content

Socket closes after 10 seconds - Error: This socket has been ended by the other party #30

@JonFranklin301

Description

@JonFranklin301

Hi there,

I am using the notify method this to read position feedback from axes, however i am finding that the socket connection closes after approx 10 seconds.

 const options = {
    host: '10.4.4.1',
    amsNetIdTarget: '10.4.4.1.1.1',
    amsNetIdSource: '10.4.4.2.1.1',
  };

// Reading this...
  var myHandle = {
    symname: 'GVL.fbRevolve.rPosition',
    bytelength: ads.LREAL,
  };

    var client = ads.connect(options, function() {
      this.notify(myHandle);
    });

  client.on('notification', function(handle) {
    console.log(handle.value);
  });

  client.on('close', function(data) {
    console.log('CLOSE', data);
  });

 client.on('error', function(err) {
    console.log('Error: ', err);
  });

This works correctly for about 10 seconds before the socket is closed.

I thought it may have been a timeout somewhere, maybe the client not sending data frequently enough(?), so have added the following:

var client = ads.connect(options, function() {
      this.notify(myHandle);

setInterval(() => {
        this.readDeviceInfo(function(err, result) {
          if (err) console.log('Error: ', err);
          console.log('\nreadDeviceInfo: ', result);
          // this.end();
        });
      }, 1000);
    });

however after about 10 seconds the following gets thrown:

Error: Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:407)
at Object.runCommand (ads.js:1014)
at Object.readDeviceInfo (ads.js:295)
at EventEmitter.ads.adsClient.readDeviceInfo (ads.js:60)
at renderer.js:153

Any Ideas how to keep the connect open?

Thanks,
Jon

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