Skip to content

Instantly share code, notes, and snippets.

@HammzaHM
Created May 23, 2021 08:59
Show Gist options
  • Save HammzaHM/dd65544197900cc40013ea0b4ea59d18 to your computer and use it in GitHub Desktop.
Save HammzaHM/dd65544197900cc40013ea0b4ea59d18 to your computer and use it in GitHub Desktop.
How to find the external @ip of the current machine in nodeJS
const net = require('net');
const client = net.connect({port: 80, host:"google.com"}, () => {
console.log('MyIP='+client.localAddress);
console.log('MyPORT='+client.localPort);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment