[Tutor] Threading + socket server (blocking IO)

Liam Clarke ml.cyresse at gmail.com
Sun Feb 19 01:15:57 CET 2006


Thanks Kent, I'll try swapping it around and see how it goes.

As for the setDaemon, my apologies. There's a

while True:
    if msvcrt.kbhit():
        break

loop afterwards, so at a keypress it exits, hence the daemon stuff.


On 2/19/06, Kent Johnson <kent37 at tds.net> wrote:
> 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