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

Mustafa Sakalsiz mustafa at liqia.com
Fri Mar 24 02:59:10 EST 2006


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.

Jean-Paul Calderone wrote:
> On Thu, 23 Mar 2006 20:06:59 +0200, Mustafa Sakalsiz 
> <mustafa at liqia.com> wrote:
>> Hi,
>>
>> I am using twisted conch to execute a remote program (say ProgA) 
>> through ssh. In ProgA, I print some datas and catch them in the 
>> dataReceived method of SSHChannel.
>>
>> Sometimes, the data comes partially, like this
>>
>> ProgA                                    dataReceived
>> ------------                              
>> --------------------------------
>> prints TWISTED                    gets TWISTED  and appends it to TOTAL
>> .
>> .
>> .
>> prints TWISTED                    if len(TOTAL) is 1020 gets TWIS 
>> (gets at most 1024)
>>                                               => then gets TED (next 
>> time)
>>
>> I think there's a buffer of something else, so dataReceived couldn't 
>> get the datas as they are printed.  They  are splitted if TOTAL 
>> reaches  1024. I am looking for a solution to prevent getting 
>> splitted data.
>
> If you want to treat your data as line-oriented, you should be using 
> LineReceiver and overriding the lineReceived method.  The dataReceived 
> method is always subject to this kind of fragmentation.
>
> Jean-Paul
>
>





More information about the Twisted-Python mailing list