[Twisted-Python] Using IConnector

Christopher Armstrong radix at twistedmatrix.com
Tue Feb 18 15:20:10 EST 2003

On Tue, Feb 18, 2003 at 09:45:44PM +0200, Dmitry Litovchenko wrote:
> I certainly need a brief sample of how to use reactor.connectWith and
> how to set up Protocol so that it correctly switches to another
> Protocol and initializes it.
> Example with:
>     self.__class__ = anotherProto.__class__
>     self.connectionMade()

You're probably better off proxying through to the other
Protocol. Changing __class__ is horrible because the two classes may
have conflicting assumptions about the self namespace. I don't know
anything about connectWith, though.

I think there's some other code somewhere in Twisted where one
Protocol wraps another.. Anyone remember where?

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

More information about the Twisted-Python mailing list