I'm not referring to
127.0.0.1
But rather the one that other computers would use to access the machine e.g.
192.168.1.6
First, click on your Start Menu and type cmd in the search box and press enter. A black and white window will open where you will type ipconfig /all and press enter. There is a space between the command ipconfig and the switch of /all. Your ip address will be the IPv4 address.
To get the client's public IP address, JavaScript acts as a third-party server-side language. JavaScript can't do it alone, so, jQuery is added to do this. JavaScript works with third-party applications to fetch the IP addresses.
An IP Address node represents an IPv4 or IPv6 address of a host or a device.
http://nodejs.org/api/os.html#os_os_networkinterfaces
var os = require('os'); var interfaces = os.networkInterfaces(); var addresses = []; for (var k in interfaces) { for (var k2 in interfaces[k]) { var address = interfaces[k][k2]; if (address.family === 'IPv4' && !address.internal) { addresses.push(address.address); } } } console.log(addresses);
https://github.com/indutny/node-ip
var ip = require("ip"); console.dir ( ip.address() );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With