[Python-Dev] Non-blocking sockets, asynchronous connects and select.select.
python-dev at alan.kennedy.name
Tue Mar 20 11:59:50 CET 2007
Thanks Josiah and Neal, you were right.
I am running the code on Windows, Server 2003. I should have mentioned
that at the start.
When I change the hostname from "" to "localhost", the code works
exactly as expected.
It's odd that this behaviour exists, only on Windows.
The jython code that I'm writing worked fine with an empty hostname
"". That jython code uses the java.net and java.nio APIs directly, and
does not have any special cases for empty hostname.
Which must mean that the underlying java implementations must be
correctly handling the empty hostname, even when running on Windows.
(Perhaps by special casing for the Windows implementation, if indeed a
peculiarity of the Windows socket libraries is the cause).
Which implies to me that cpython, like java, should not have different
behaviour on Windows vs. other platforms; it lessens portability. Lack
of portability is confirmed by Neal's report that the original
unmodified snippet (i.e. with hostname == "") works correctly under
cpython on Linux.
On 3/20/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> > SERVER_ADDRESS = ("", 54321)
> Replacing the above with:
> SERVER_ADDRESS = ("localhost", 54321)
> ...makes it work for me on Windows CPython 2.3.5 and 2.5 .
> - Josiah
More information about the Python-Dev