[Twisted-Python] Help With Twisted as a Client (newbie warning)

Steve Milner smilner at trinityz.com
Thu Feb 24 09:43:35 MST 2005


Itamar Shtull-Trauring wrote:

>On Thu, 2005-02-17 at 11:25 -0500, Steve Milner wrote:
>
>  
>
>>factory.clients = []
>>sslFactory = ClientContextFactory()
>>application = service.Application("xmlclient")
>>reactor.connectSSL("__example__.com", 1026, factory, sslFactory)
>></snip>
>>
>>Is there a way I can access xmlxlient inside application?
>>    
>>
>
>The application object is not used for that (and certainly can't be used
>if it doesn't have a reference to the factory, it doesn't magically get
>one). Hand a reference to the factory to whichever objects wishes to
>control the instance.
>
>
>  
>
Thanks for the reply. I'm not sure I compleatly follow what you mean. 
Doing the following doesn't seem to work as it yeilds  [Failure 
instance: Traceback: exceptions.AttributeError, xmlclient instance has 
no __call__ method .....

<snip>
factory = ClientFactory()

factory.clients = []
sslFactory = ClientContextFactory()
client = xmlclient()
factory.protocol = client
application = service.Application(client)
</snip>

I also tried

<snip>
factory = ClientFactory()

factory.clients = []
sslFactory = ClientContextFactory()
client = xmlclient()
factory.protocol = xmlclient
application = service.Application(client)
</snip>

which connects but seems to be using a different instance of the  
xmlclient object. How can I get access to the xmlclient object inside 
the factory?

Thanks!
Steve




More information about the Twisted-Python mailing list