Max 64 connections/thread under Windows?

Krister L. no-spam at no-spam.org
Mon Nov 3 17:18:08 EST 2003


Hi all,

Newbie warning on.

I'm having a problem under Windows where I'm getting an error 10055 when 
I'm using select() and having 64 sockets open in a single thread. The 
description for 10055 is "An operation on a socket could not be 
performed because the system lacked sufficient buffer space or because a 
queue was full".

I found some more info about this here: 
http://www.sockets.com/winsock.htm#Deviation_MaxSockets

When reading /Python-2.3.2/Modules/selectmodule.c I found the following 
snippet

/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined.
    64 is too small (too many people have bumped into that limit).
    Here we boost it.
    Users who want even more than the boosted limit should #define
    FD_SETSIZE higher before this; e.g., via compiler /D switch.
*/
#if defined(MS_WINDOWS) && !defined(FD_SETSIZE)
#define FD_SETSIZE 512
#endif


which to me looks like Python is trying to increase the value of this 
constant, but fails to do so (My only evidence for this is that I'm 
getting this error).



To pick up the errno I also need to write something like
     except error, (errno, strerror):

when I would expect
     except error
         errno, strerror = error

to work if I have interpreted the documentation correctly:

...The exception raised when an error occurs. The accompanying value is 
a pair containing the numeric error code from errno and the 
corresponding string, as would be printed by the C function perror().




Should this trigger a WindowsError exception by the way? (selectmodule.c 
calls PyErr_SetExcFromWindowsErr to create the exception.)


/Krister





More information about the Python-list mailing list