Max 64 connections/thread under Windows?

K

Krister L.

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
 
J

Jp Calderone

Hi all,

Newbie warning on.

[snip]


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

When you use the former syntax, the exceptions arguments are unpacked into
the (errno, strerror). You can achieve the same by doing:

except error, e:
errno, strerror = e.args


Also, I would recommend not doing "from socket import error", but rather
"import socket" and then using "socket.error". This helps keep code more
clear and easy to read.

Jp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top