[Twisted-Python] Using twisted.conch

listbox at evernex.com listbox at evernex.com
Thu Mar 22 17:05:17 EDT 2007

pico wrote:
> The problem is that, due to the ClientFactory creating instances of 
> the relevant objects for you 
> (SSHClientTransport,SSHUserAuthClient,etc), you are left without a 
> reference to the SSHChannel object,required to run the command.
> Is there any way to get the SSHChannel object from the 
> SSHClientTransport instance.
> Any advice with this matter would be appreciated.

I confess to not fully understanding your question, but perhaps a (sort 
of) singleton object might do it?  In the ClientFactory (or whereever 
the SSHChannel is created), instantiate the singleton object and then 
assign the SSHChannel to a variable tacked onto it.  You can assign 
'self' to such a variable too. Then every time you instantiate that 
singleton object again, it has the reference already in it.

I use the 'Borg' class to do this and I've used it to store references 
to a netstringReceiver in my own Twisted code.


More information about the Twisted-Python mailing list