I am running an python IRC server using py2exe and am running into a problem with maximum connections (approx 1970).

The following is displayed:

Exception in thread Thread-1957:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "threading.pyc", line 663, in run
  File "threading.pyc", line 440, in start
error: can't start new thread

I assumed this might be a RAM issue (1GB on my current machine), and ran the same script on a much more powerful server (4GB) and had the same results, so it cannot be that.

When I run the python script itself (not via py2exe) it only allows approx 1015-1020 connections, so using py2exe alone almost doubles the limit. Can anyone offer some information as to why this is, and how I can further increase the limit.

After googling around it appears that in order to allow more connections per process I need to raise my FD limit, is this true (and how can I do it using py2exe).

My platform is Windows XP.

Thanks in advance for any help!