[Tutor] Turning a "script" into an "application"
Christian Wyglendowski
Christian.Wyglendowski at greenville.edu
Wed Oct 27 16:15:03 CEST 2004
> -----Original Message-----
> From: tutor-bounces at python.org
> Subject: RE: [Tutor] Turning a "script" into an "application"
>
> Christian,
>
> If you want to be able to control your sniffer from a variety
> of front ends (command-line, GUI, web app) then you probably
> have to write it as a separate process with some kind of
> socket interface. If you can pick a single UI, and you are
> happy to have the UI running at the same time as the sniffer,
> you could make the sniffer a separate thread in the same
> application as the GUI.
So I guess it is breaking down like this:
o Threads for an all-in-one approach
o Sockets for a more modular approach
> If you decide to build a separate sniffer process, I suggest
> you build the communications protocol on top of an existing
> standard.
.
. (snipped)
.
> For example you could use XMLRPC to talk to the sniffer.
> Using xmlrpclib on the client side and SimpleXMLRPCServer on
> the sniffer side it is easy to set up. The client then makes
> procedure calls on the server through a proxy. The advantage
> of this method is it is easy to set up and it gives you a
> very pythonic interface on the client side. The disadvantage
> is that it is not easy to use the interface without writing a program.
This sounds promising. I spent some time with the Python Cookbook last
night and happened to look over some of the XMLRPC recipes. Considering
that I want to keep things pretty loose as far as the
interface<-->backend ties go, a socket based approach using XMLRPC looks
pretty good right now.
.
. (more snipping)
.
> I suggest you start with the first version - GUI and sniffer
> in one application. It is a good first step even if the
> eventual goal is to have a separate sniffer process. Keep a
> strong separation between the two parts so if you decide
> later to split them it won't be too hard.
I might wind up doing this eventually for a lightweight, easy to
distribute application. Plus, I think I eventually need to get my hands
dirty when it comes to threads. For now I think I am going to start
digging into XMLRPC and using multiple processes. Thanks a lot for the
insight and information.
Christian
http://www.dowski.com
More information about the Tutor
mailing list