1

I have a problem finding local IP address in NodeJS. The best solution I have found so far is to call the os.networkInterfaces() method (or ifconfig) and simply parse the results checking if family == 'IPv4' and internal == true. The problem is, when we have an VM installed with a virtual network interface, we get two such addresses and there is no way (or is there?) to distinguish which one is the 'real' one.

Any idea how to do it?

Thanks in advance

  • 2
    http://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js - Probably a duplicate – Christian Stewart Mar 24 '13 at 23:44
  • 1
    As you have said, you can have any number of IP addresses. Why do you need this? Normally when starting a app you either have to configure a specific IP, or accept that it will listen on all of them. – loganfsmyth Mar 24 '13 at 23:50

0 Answers0