You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 10, 2019. It is now read-only.
An environment with AF_INET6 sockets but no loopback interface creates
nothing but pain.
If an IPv4 server binds to 0.0.0.0:8080, clients may connect to
0.0.0.0:8080, which automatically picks 127.0.0.1 as a source address.
However, when a server binds to [::]:8080, the absence of ::1 causes
clients to fail with ENETUNREACH.
For a demonstration, run the following in a python shell:
import socket
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
s.bind(("", 0))
print s.getsockname() # Example: ('::', 39079, 0, 0)
s.listen(10)
c = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
c.connect(s.getsockname())
print c.getsockname(), c.getpeername()
This yields the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 101] Network is unreachable
0 commit comments