
[please don't top-post] On Thu, Dec 01, 2005 at 04:22:03PM +0800, Xu Ryan wrote:
Does Client Creator load protocol's "connectionMade" automatically , same as factory?
ClientCreator is just a shortcut for creating the factory and so forth manually. The event handlers (connectionMade, dataReceived, connectionLost) on the resulting protocol will be invoked as normal. So yes, connectionMade will be called (assuming a connection is made, if the connection fails the Deferred returned from ClientCreator.connectTCP will have an error instead), but this isn't really anything to do with ClientCreator: once the connection is established, ClientCreator is not involved. Experimenting with the example at http://twistedmatrix.com/projects/core/documentation/howto/clients.html#auto... might be a good idea. The source code for ClientCreator is quite simple. Perhaps it would be worth reading and understanding that, so you can see how little code is involved. The definition of ClientCreator is found in twisted/internet/protocol.py: http://svn.twistedmatrix.com/cvs/trunk/twisted/internet/protocol.py?view=auto&rev=14194 -Andrew.