integrating SocketServer with Tkinter Event-Loop

Fredrik Lundh fredrik at pythonware.com
Wed Oct 20 03:13:33 EDT 1999


Peter Funk <pf at artcom-gmbh.de> wrote:
> Well: the asyncore 'poll()' uses 'select' and so internally asserts that 
> the socket is ready to read at the time, when xmlrpcserver.RequestHandler
> gets called by SocketServer.TCPServer.handle_request.  I wasn't able to 
> figure out, where the non blocking socket would play havoc to the code
> in 'SocketServer.py' ...  :-(

well, I'm not 100% sure, really, but this may work only if the
read operations never run out of data (which may be the
case in your test setup -- your server is simply fast enough...).

but I might be wrong, and I suspect it'll take a while to set
things up so I can verify that...

> I was afraid, that it wouldn't be that easy. :-(
> 
> Do you have any better suggestions how to accomplish, what I want?

ah, that's easier!  I'd use two dispatchers: one for the listening
socket, and one to handle the connection channels.  when the
former accepts a new connection, it creates an instance of the
latter which implements the actual protocol.

<!--
if you have the eff-bot guide, check the examples on page 166
and 172 (the HTTP example shouldn't be that hard to tweak for
XML-RPC; drop me a line if you need help).
-->

or you can look at the medusa sources.

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list