when I run '(sleep 1; echo flush_all; sleep 1; echo quit; ) | telnet localhost 11211' I get

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
OK
Connection closed by foreign host.

The above command does what I want but what about the ::1 part?

link|improve this question

feedback

3 Answers

up vote 7 down vote accepted

The software listening on port 11211 doesn't support IPv6. Since localhost is an entry in the hosts file that tries an IPv6 address first, you only fail back to IPv4 after IPv6 fails. You can solve the issue by either getting the software updated (or properly configured to listen on IPv6 if it's an option in the config file) or changing your command to telnet 127.0.0.1 instead of telnet localhost.

link|improve this answer
fixed, works + great explanation. Thank you. – Radek Apr 18 '11 at 0:55
feedback

::1 is the IPv6 loopback address, the equivalent of the IPv4 loopback 127.0.0.1.

link|improve this answer
feedback

To avoid the ipv6 connexion, use the '-4' switch:

$ telnet -4 localhost
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

The same with '-6' :

$ telnet -6 localhost
Trying ::1...
Connected to ::1.
Escape character is '^]'.

It works with a lot of network utilities, like wget, curl, ssh,...

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.