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

Tommi Virtanen tv at twistedmatrix.com
Wed Aug 24 00:29:34 EDT 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)

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

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

More information about the Twisted-Python mailing list