Reputation: 48526
Originally, there is one third library used in my legacy codes, and one IP address configuration for it. Its default value is localhost
. For IPV4
, we know, the value of localhost
is 127.0.0.1
.
However, I find this value changed to ::1
. According to this, ::1
represents the localhost
for IPV6
and whole address is 0:0:0:0:0:0:0:1
.
Here are my questions:
Is there any different between 127.0.0.1
and ::1
? If ::1
is used, any impact on my program?
For the localhost
configuration. Why 127.0.0.1
is used sometime, while ::1
is used sometime? Does it depend on the OS?
Upvotes: 0
Views: 166
Reputation: 21460
127.0.0.1
is an IPv4 address while ::1
is the equivalent IPv6 address.
There is no other difference beside the IP protocol version between the two. Semantically, they behave the same, as long as your stack supports both protocols.
Upvotes: 2