[Twisted-Python] Getting splitted data with SSHChannel.dataReceived

Tommi Virtanen tv at twistedmatrix.com
Sun Mar 26 04:58:58 EST 2006

Mustafa Sakalsiz wrote:
> Yes, I am using line oriented datas. But, I am subclassing the 
> twisted.consh.ssh.channel.SSHChannel, so how can I use a subclass of
> basic.LineReceiver to open a channel in SSHConnection.

When inheritance fails, use ownership.

class MyLineReceiver(basic.LineReceiver):
   def lineReceived(self, line):

class MySSHChannel(channel.SSHChannel):
   def __init__(self, ...):
      self.protocol = MyLineReceiver()

   def dataReceived(self, data):

More information about the Twisted-Python mailing list