socket programming project

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu Jun 26 02:30:48 EDT 2003


On Thu, Jun 26, 2003 at 06:02:17AM +0000, drs wrote:
> Hi,
> 
> I have a programming design question.  I would like to do this in Python,
> but I am not even sure about what tools are proper or where to start
> reading.

An excellent tool for socket programming is Twisted:
    http://twistedmatrix.com/

> I am trying to make a small network system where several client computers
> connect to a server.  each client can send messages to the server which must
> alert all of the clients of the information in the messages.  Further, the
> server must be able to alert all connected clients about other occasional
> information. The total number of messages is low, however. for now, security
> is not an issue if that matters.

You might like PB, Twisted's remote object protocol, which can do all this.
It might be overkill though; I recommend you take a look at the docs and
decide for yourself.  Twisted also has support for lots of standard
protocols, including stuff like XML-RPC.

If you want to use a custom protocol, that's also pretty easy in Twisted.

> I know a way to do this in win32 using dcom, but this seems sloppy, and i
> need it to run on freebsd and win32 at a minimum, and pocketPC if at all
> possible. I also thought about using ZEO coupled with a Queue class, but I
> am not sure about clients reacting to events in this case, or about ZODB/ZEO
> on pocketPC.

Twisted runs on FreeBSD and Win32, and I seem to recall someone got it
working on a PocketPC or something like it without too much effort.  

> (The specifics of the project are to make a wifi enabled jukebox out of an
> old freebsd computer hooked to my stereo which can be controlled by all of
> the other computers in the house. I did a previous version of this using
> SimpleHTTPServer, but this seems a dead end for forcing the playlist queue
> and such onto clients.)

That sounds like an excellent use for Twisted.  I don't think it's actively
developed, but there's a project called "mc-foo" that is a Jukebox using
Twisted.  You may want to start there, rather from scratch.

-Andrew.






More information about the Python-list mailing list