user6631556
user6631556

Reputation:

How to get IP address in node.js

How in node.js I can get the IP adress of my server?

I need know this ip for conection with my server, but I dont know where I can see this ip adress(

Upvotes: 1

Views: 816

Answers (1)

jfriend00
jfriend00

Reputation: 708016

On Windows, go to console window and type ipconfig. You should get a listing that will have a section like this in it:

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::7533:a40e:4362:5c49%4
   IPv4 Address. . . . . . . . . . . : 192.168.1.7      <=== This is it
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

That is the IP address of your computer on your local LAN and can be used to reach it from within your local LAN.

This a dynamically assigned IP address. It can change from time to time, though will typically stay the same for long periods of time.


If you want to reach it from the internet, that is more complicated as you will need the public IP address of your internet connection and will need to set up port forwarding in your router.

Upvotes: 1

Related Questions