What's the difference in telling a service to run on localhost:xxxx, and

I needed to use to get another host to be able to connect to my service.


2 Answers 2

18 is the normal loopback address, and localhost:xxxx is the hostname for is slightly different, it's an address used to refer to all IP addresses on the same machine. Or no specific IP address.

Here's a stack exchange post that explains the difference in more detail What's the difference between ip address and


localhost is a special virtual network interface, just like your ethernet or wifi each have a special interface.

The difference is that localhost, being a network interface, is very specific. When you say that you want to connect to, you are connecting specifically to localhost. Just like you specify IP of your wifi/ethernet to connect to those interfaces. however, is not really an interface and it means to just try and connect to every available interface. This will try and connect to all the available interfaces instead of just

Hence two are different.

EDIT: This here probably explains it a lot better an in greater detail: https://superuser.com/questions/949428/whats-the-difference-between-127-0-0-1-and-0-0-0-0

Not the answer you're looking for? Browse other questions tagged .