[Twisted-Python] How could I distinguish each TCP connection?

Christopher Armstrong radeex at gmail.com
Tue Jun 21 00:56:57 EDT 2005


On 6/21/05, Eric Hsu <nkeric at gmail.com> wrote:
> Hi all,
>  
>  I'm familiar with the thread-style network programming (create a single
> thread for each connected client).
>  With twisted, how could I know which client I'm talking to? (or, how could
> I maintain the connections list?)
>  
>  I'm thinking of creating a Client object to represent each connected client
>  Could I save the transport to the Client object so that I can retrive that
> transport back to talk to a specific client?

You can do it based on the Protocol instance. For TCP, there is one
Protocol instance per connection, and it has access to the transport.

-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  
w----v----w-+




More information about the Twisted-Python mailing list