Hey there.
Just for starters, I used Twisted and SocketServer with both ForkMixIn, ThreadMixIn and tried the "thread-pool" recepies.
However, I wanted to make something particular work in Python.
Alittle background. Previously I wrote in C a simple TCP deamon that would bind to a socket and listen on it, then pre-fork X many times and then just pass the serversocket desc to all the forks and everyone would accept the clients very very marrily.
I checked out the "select/poll" based asyncore which I like alot. My only beef was that I could get a little CPU unbound by forking a few times to take advantage of the multi-cpu machine and hope for the best with scheduling.
I cant make it work for the life of me. Only 1 single instance can accept connections, all others simply throw an exception on handling the connect, 'can not iterate thru Empty'.
is this even feasible? I checked alot, but I couldnt find ANY code for forking asyncore dispatchers (cry)
Thank you!
Update 1: (Full traceback as requested)
error: uncaptured python exception, closing channel <__main__.EchoServer listening 0.0.0.0:8001 at 0x2ad4880c93f8> (<type 'exceptions.TypeError'>:'NoneType' /python2.6/asyncore.py|readwrite|99] [/usr/local/python2.6.9/lib/python2.6/asyncore.py|handle_read_event|408] [./6py-server.py|handle_accept|87])
Always happens in accept, regardless if I fork before the asyncore.loop, etc.
Update 2: (full source) pastebined source