asynchat and threading

Jp Calderone exarkun at divmod.com
Wed Nov 24 10:25:50 EST 2004


On Wed, 24 Nov 2004 14:57:44 GMT, Rob Snyder <arkham at gmail.com> wrote:
>Greetings -
> 
> I've embarked on a small learning project, trying to get a better grasp of
> the asyncore and asynchat modules. The project involves building a simple
> instant messenger application for use on our LAN - nothing heavy duty, as
> 99% of my reason for doing this is just to learn.
> 
> [snip]
> 
> There *must* be some way to use this asyncore stuff on the client side, but
> I'm not seeing it. I'm about to bail on it for the client, but I thought
> I'd put this out there to see if anyone can help me see a different
> approach to this stuff.

  I'm sure there is some way, but I doubt it's pretty.  asyncore is pretty minimal, and gives no thought to integration with other mainloops.

  Twisted, on the other hand, integrates with several different GUI toolkits.  Without threads, even.

    http://www.twistedmatrix.com/

  This is just one of the things it does better than the standard library.  Embarking on a "learning project" using Twisted rather than asyncore is almost certain to bring more long term benefits, since you'll have learned how to use something you can develop actual software with. ;)

  Of course, since your server is already written, you can keep that code and start off with Twisted by just working on the client.  Sockets make interoperability a cinch. :)

  Jp



More information about the Python-list mailing list