[Tutor] Threading + socket server (blocking IO)

Kent Johnson kent37 at tds.net
Sat Feb 18 13:35:53 CET 2006


Liam Clarke wrote:
> Hi,
> 
> Just coming back to the server end of things. Kent, could I please ask
> you to confirm that I'm not doing anything abnormal with the
> ThreadingMixIn? The code is here at rafb:
> http://www.rafb.net/paste/results/915JVm90.html
> 
> Basically, when I test it using a script to generate the datagrams via
> localhost, the server misses anywhere between 200 - 400 datagrams out
> of 1041.

I don't have time for a detailed response but it looks OK except 
ThreadingMixin needs to be the first base class because it overrides a 
method of UDPServer. It turns out there is a class 
SocketServer.ThreadingUDPServer that does this.

Also I'm surprised the program stays running - ISTM with the server 
thread marked daemon and the main thread exiting the program should exit...

Kent



More information about the Tutor mailing list