running on Mac with two jetty instances i've arrived to this peculiar situation:
~$ lsof -ni :9905
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 40320 ******* 394u IPv6 0xf5e143eb9100c205 0t0 TCP *:9905 (LISTEN)
java 40325 ******* 302u IPv6 0xf5e143eb79be9005 0t0 TCP 127.0.0.1:9905 (LISTEN)
I've tried to recreate this situation in python, but that failed (as i feel it should):
>>> s = socket.socket()
>>> s.bind(("",12345))
>>> s.listen(1)
>>> z = socket.socket()
>>> z.bind(("localhost",12345))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 48] Address already in use
I also tried with AF_INET6 with the same results.
does anyone have a clue on what's going on here? how can this even occur? I was under the impression that the asterisk is bound to ALL addresses... if this is indeed a normal behaviour, what is the correct why to recreate it in python?
Thanks!