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

Can't get a IP address #29

Open
xzycn opened this issue Mar 27, 2018 · 2 comments
Open

Can't get a IP address #29

xzycn opened this issue Mar 27, 2018 · 2 comments

Comments

@xzycn
Copy link

xzycn commented Mar 27, 2018

Hi, I can't get a certain IP address, got a 'undefined' instead :)
After I dive into the source code,I found that os.networkInterfaces() returned a weried NetConnectionID(yes, it's on Windows 7) with "????",actually is "本地连接"。So,in my guess,it's a case of string encoding,however, I don't know how dose this happen.

@tomas
Copy link
Owner

tomas commented Mar 27, 2018

Can you show the full output?

@xzycn
Copy link
Author

xzycn commented Mar 27, 2018

@tomas Hi,I just added three lines of code in win32.js (in line 74)as follows to debug:

console.log(obj.name)
console.log(node_nics)
console.log(node_nics[obj.name])

Then it outputs:

????
{ '????':
   [ { address: '******',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '********',
       scopeid: 11,
       internal: false,
       cidr: '*******' },
     { address: '192.****',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '******',
       internal: false,
       cidr: '********' } ],
  'Loopback Pseudo-Interface 1':
   [ { address: '::1',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 0,
       internal: true,
       cidr: '::1/128' },
     { address: '127.0.0.1',
       netmask: '255.0.0.0',
       family: 'IPv4',
       mac: '00:00:00:00:00:00',
       internal: true,
       cidr: '127.0.0.1/8' } ] }
undefined

And this is the output for os.networkInterfaces():

> os.networkInterfaces()
{ '????':
   [ { address: '*****',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '******',
       scopeid: 11,
       internal: false,
       cidr: '******' },
     { address: '*******',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '*********',
       internal: false,
       cidr: '**********' } ],
  'Loopback Pseudo-Interface 1':
   [ { address: '::1',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 0,
       internal: true,
       cidr: '::1/128' },
     { address: '127.0.0.1',
       netmask: '255.0.0.0',
       family: 'IPv4',
       mac: '00:00:00:00:00:00',
       internal: true,
       cidr: '127.0.0.1/8' } ] }

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

2 participants