Launching Multiple Servers

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu May 22 04:34:43 EDT 2003


On Thu, May 22, 2003 at 09:43:31AM +0200, user at domain.invalid wrote:
> >Norbert Klamann wrote
> 
> 
> >Why SocketServer ? Wouldn't 'Twisted' do the trick ? It delivers a lot
> >of the necessary infrastructure to do these things the right way(tm).
> 
> Twisted does certainly the trick, but i must admit that is seems complex
> and the documentation is poor.
> If you know some good doc. i'm your client

Twisted isn't so much complex as *large*.  The trick is knowing which bits
matter to you, and which parts to ignore -- unfortunately, or docs are
fairly mediocre at helping you with that :(

Regardless, I think Twisted is worth investing a little time into.  The
essentials for writing servers are here:
    http://twistedmatrix.com/documents/howto/servers

That doc doesn't mention this, but listening on multiple ports is easy; you
can simply do:

    reactor.listenTCP(10001, factory1)
    reactor.listenTCP(10002, factory2)
    # etc...

You can even use the same factory on multiple ports.

Feel free to ask for help on twisted-python at twistedmatrix.com, or on
#twisted on irc.freenode.net -- there's usually someone around who's happy
to help.

-Andrew.






More information about the Python-list mailing list