[Twisted-Python] Question about writing a server that accepts multiple clients with independent processing

Gabriel Rossetti mailing_lists at evotex.ch
Thu Feb 21 04:31:16 EST 2008


I am new to Twisted and I'm trying to write a server that accepts 
multiple client connections
and processes them separately. I *think*  this is done with a protocol 
instance per client connection, but I may be 100% wrong. I don't really 
understand how to do this with twisted. In a threaded server I would :

1) wait for a client connection
2) create a thread and hand it the client connection

then the server waits again for the next client connection, the thread 
executes the protocol, e.g. dialogs with the client until disconnection.

I have done this so far using Twisted :

1) created a protocol (the one that would be executed in a separate 
thread in the example above)
2) created a factory and listen for incoming connections.

This works great if I have one connection, but I need multiple 
connections being processed in parallel (simulated parallelism I guess)

Could someone please explain how Twisted works for this or point me to 
some documentation explaining this? I have searched the docs on the 
twisted website and google, but I can't find anything explaining this.

Thank you,

More information about the Twisted-Python mailing list