James Hutchison added the comment:

Looks to me like python grabs an outgoing port number via unrandom means and if 
it happens to map to a port taken by a service that demands exclusive access, 
then it returns the WSAEACCESS error instead of WSAEADDRINUSE. Because this is 
a fairly new "feature" in windows (NT 4.0 w/ SP3), Python does not properly 
account for it by simply trying another port like it would if it got 
WSAEADDRINUSE

Arguably this would affect all aspects of Python that uses sockets.

The function in question seems to be:

getaddrinfo(host, port, 0, SOCK_STREAM)

Which, if I'm understanding the code correctly, returns the source address used 
to make the connection in this instance. Unfortunately, that function is in a 
compiled binary so I don't know how it works.

If windows is responsible for giving the bad port number, I would argue that 
Python still needs to account for the problem since this is obviously a major 
issue if it happens to someone. The fact that you mentioned that the cause is 
the fact WSAEADDRINUSE isn't the error, then that seems to imply Python is 
doing the selection.

If python is using a windows library to get outgoing port, it is also possible 
that maybe that library is outdated and it needs to use a newer one.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15779>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to