[Twisted-Python] Making a Persistent SSH connection w/ Conch - How?

Tommi Virtanen tv at twistedmatrix.com
Tue Aug 23 22:29:34 MDT 2005


J French wrote:
> if possible.  I grabbed the the sshsimpleclient.py code from
> http://twistedmatrix.com/projects/conch/documentation/examples/sshsimpleclient.py
>  and modified (to test the behavior):
> 
>     def closed(self):
>         print 'got data from cat: %s' % repr(self.data)
>         #self.loseConnection()
>         #reactor.stop()
> 
> The server connection still closes as soon as I receive the callback
> data. I'm using freebsd and it works as advertised (I see the

Of course it closes, that's what the client side is programmed to do.

    def channelOpen(self, ignoredData):
        self.data = ''
        d = self.conn.sendRequest(self, 'exec', common.NS('cat'),
wantReply = 1)
        d.addCallback(self._cbRequest)

    def _cbRequest(self, ignored):
        self.write('hello conch\n')
        self.conn.sendEOF(self)

Maybe sending EOF isn't the smartest move if you want to keep the thing
open..




More information about the Twisted-Python mailing list