Created
May 23, 2021 08:59
-
-
Save HammzaHM/dd65544197900cc40013ea0b4ea59d18 to your computer and use it in GitHub Desktop.
How to find the external @ip of the current machine in nodeJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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