Machines have multiple IP addresses, listen carefully

When starting a server that you want clients to be able to connect to, you need to specify a port and an address that the server will listen on.

For example in Node, http.createServer().listen(8080, "127.0.0.1") will listen to port 8080 on the loopback address.

It is important to note that a single machine will have multiple IP address due to its multiple interfaces (loopback, Wi-Fi, Ethernet). So, when configuring a listening server, you need to specify an address.

Here are some example interfaces / IPs:

The “loopback” address is a reserved address that points back to the same device. Any data sent to this address is routed back to the device without leaving the network stack. “localhost” is a host name that will resolve to the loopback address.

When starting a server, you should be intentional on what address you are listening on. For local development it is safest to use the loopback address.