adbkit icon indicating copy to clipboard operation
adbkit copied to clipboard

"Error: getaddrinfo ENOENT" when haven't any connection network?

Open 25512345 opened this issue 9 years ago • 1 comments

I use this code to get list android device connected in windows. But when I turn off all my network card or my network down it will catch exeption "getaddrinfo ENOENT". It will work when I have any network card connected even this is network card to virtual machine. How can I get listdevice when my network down?

const adb = require('adbkit');
const client = adb.createClient();

client.listDevices()
  .then(function(devices) {
    console.log(devices);
    //Set link button if detect device
  })
  .catch(function(err) {
    console.error('Something went wrong: ' + err);
  });

25512345 avatar Nov 03 '15 07:11 25512345

Maybe if no connection connected, adbkit cannot lookup ip localhost. With options when create client has solve this problem :smile:

const client = adb.createClient({host: "127.0.0.1", port: "5037"});

25512345 avatar Nov 10 '15 02:11 25512345