[Python-Dev] Pervasive socket failures on Windows
tim.peters at gmail.com
Fri Feb 10 22:35:49 CET 2006
[Martin v. Löwis]
> I think the Windows interpretation is actually well-designed: FD_SETSIZE
> shouldn't be the number of the largest descriptor, but instead be the
> maximum size of the set.
It's more that the fdset macros were well designed: correct code
using FD_SET() etc is portable across Windows and Linux, and that's so
because the macros define an interface rather than an implementation.
BTW, note that the first argument to select() is ignored on Windows.
> So FD_SETSIZE is 64 on Windows,
In Python FD_SETSIZE is 512 on Windows (see the top of selectmodule.c).
> but you still can have much larger file descriptor numbers.
Which is the _source_ of "the problem" on Windows: Windows socket
handles aren't file descriptors (if they were, they'd be little
> In any case, POSIX makes it undefined what FD_SET does when the
> socket is larger than FD_SETSIZE, and apparently clearly expects
> an fd_set to be a bit mask.
Yup -- although the people who designed the fdset macros to begin with
didn't appear to have this assumption.
More information about the Python-Dev