A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/060800.html below:

[Python-Dev] Pervasive socket failures on Windows

[Python-Dev] Pervasive socket failures on Windows [Python-Dev] Pervasive socket failures on Windows"Martin v. Löwis" martin at v.loewis.de
Sun Feb 12 00:54:41 CET 2006
Tim Peters wrote:
> The code in selectmodule when _MSC_VER is _not_ defined complains if a
> socket fd is >= FD_SETSIZE _or_ is < 0.  But the new code in
> socketmodule on non-Windows boxes is happy with negative fds, saying
> "fine" whenever fd < FD_SETSIZE.  Is that right or wrong?

I think it is right: the code just "knows" that negative values
cannot happen. The socket handles originate from system calls
(socket(2), accept(2)), and a negative value returned there is
an error. However, the system might (and did) return handles
larger than FD_SETSIZE (as the kernel often won't know what
value FD_SETSIZE has).

> "The answer" isn't so important to me as that this kind of crap always
> happens when platform-specific logic ends up getting defined in
> multiple modules.  Much better to define macros to hide this junk,
> exactly once; pyport.h is the natural place for it.

That must be done carefully, though. For example, how should
the line

                max = 0;                     /* not used for Win32 */

be treated? Should we introduce a
#define Py_SELECT_NUMBER_OF_FDS_PARAMETER_IS_IRRELEVANT?

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4