Message6666
socket.getsockname() doesn't return a sensible value until socket.listen() has been called.
CPython's socket.getsockname() also works without calling listen().
Reproduce session:
[E:\projects\jython]dist\bin\jython.bat
Jython 2.6a0+ (, okt 8 2011, 17:15:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> s=socket.socket()
>>> s.bind(('',0))
>>> s.getsockname()
(u'127.0.0.1', 0) # <-- hmmm
>>> s.listen(5)
>>> s.getsockname()
(u'0.0.0.0', 56068) # <-- correct ip and (random) port number
>>> |
|
Date |
User |
Action |
Args |
2011-10-09 23:11:55 | irmen | set | recipients:
+ irmen |
2011-10-09 23:11:55 | irmen | set | messageid: <1318201915.08.0.987123807216.issue1806@psf.upfronthosting.co.za> |
2011-10-09 23:11:55 | irmen | link | issue1806 messages |
2011-10-09 23:11:54 | irmen | create | |
|