SockerServer.TCPServer problem

huy nytimes at swiftdsl.com.au
Tue Aug 17 11:28:39 EDT 2004


Jeremy Jones wrote:

> huy wrote:
> 
>> Hi All,
>>
>> Can someone explain why this bit of code can't keep up with some java 
>> code which spawns about 200 (threads) simultaneous connections each 
>> sending about 10 mesgs each. I basically don't get the 2000 
>> connections i expect on the python side. I end up with some number 
>> very close on different runs eg. 1989, 1972, 1992 etc.
> 
> 
> <snip>
> 
> (Sorry if I post this twice - I'm trying out a new mail client.)
> 
> You may want to try using the ThreadingTCPServer class rather than 
> TCPServer.  Just change this line:
> 
>>    msg_server = SocketServer.TCPServer(("", LISTENING_PORT), PDAHandler)
> 
> 
> 
> to this:
> 
>   msg_server = SocketServer.ThreadingTCPServer(("", LISTENING_PORT), 
> PDAHandler)

Thanks, I'll try that.

> BTW - how are you tracking how many connections you have open with the 
> Python server?  It may be that the process accepts the connection, puts 
> them into a queue to be handled, and waits for the deals with them as it 
> can.  Or is the 2000 the total number of connections that the 200 
> threads produce over the whole run (each making 10 connections)?
> 

every connection creates a file. i count the number of files created.

> Jeremy Jones



More information about the Python-list mailing list