TScSSHClient + TScSSHShell = READ LIMIT 4096 bytes ?!

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
milan.gsm
Posts: 5
Joined: Fri 20 Oct 2017 17:02

TScSSHClient + TScSSHShell = READ LIMIT 4096 bytes ?!

Post by milan.gsm » Sat 18 Nov 2017 20:24

Actually I am working with the SecureBridge for few weeks. Already purchased the basic license and my application is almost working fine. Unfortunatelly at the moment I have meet one strange problem, and I was not able to solve it within several hours ... the problem is following:

I have TScSSHClient and TSCSSHShell component used in my project.
SSH2 server connection is OK, receiving and sending data is OK ...

The problem occurs when the SSHShell receive more then 4096 bytes at once!

For example when the incoming data detected via OnAsyncReceive and the length of received data is for example 4100 bytes (SSHShell.InCount inditates 4100 value) only the first 4096 bytes are processed correctly. The rest (4100-4096 = 4bytes) are mismatched and incorrect !!!

During the next OnAsyncReceive event the rest of data are received additionally. But these data is not possible to read out before the new OnAsyncReceive happens. InCount indicates 0 bytes waiting ...

I have tried several methods: SSHShell.ReceiveString(), SSHShell.ReadBuffer(), SSHShell.ReadNoWait()
Actually I am reading the buffer byte-by-byte using the method SSHShell.ReadBuffer(buffer,0,1) and building the string from recived characters ... I have also tested with delays included and everythink.
I have no more ideas.

The TScSSHClient OPTIONS properties are set to: SocketReceiveBuffer and SocketSendBuffer are both set to Receive. For the TScSSHShell I am using the NONBLOCKING MODE=TRUE


Could you please confirm that it is possible to read more then 4096 bytes received via TScSSHClient using TScSSHShell at once ??? I have no succes .. thank you very much.

milan.gsm
Posts: 5
Joined: Fri 20 Oct 2017 17:02

Re: TScSSHClient + TScSSHShell = READ LIMIT 4096 bytes ?!

Post by milan.gsm » Sat 18 Nov 2017 21:30

I have also tried to use SSHChannel component to make DIRECT connection and test if the transfer success, butactually OPEN FAILED, appears everytime:

SSHClient.Authentication:= atPublicKey;
SSHClient.KeyStorage:= MemStorage;
SSHClient.HostKeyName:= 'SERVER_KEY';
SSHClient.PrivateKeyName:= 'PRIVATE_KEY';
SSHClient.HostName:= 'x.x.x.x';
SSHClient.User:= 'username';
SSHClient.Port:= yyy;
SSHClient.Connect;
SSHChannel.Client:= SSHClient;
SSHChannel.Direct:= True;
SSHChannel.NonBlocking:= True;
SSHChannel.DestHost:= SSHClient.HostName;
SSHChannel.DestPort:= SSHClient.Port;
SSHChannel.Connect;

If SSHChannel replaced with SSHShell it works.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TScSSHClient + TScSSHShell = READ LIMIT 4096 bytes ?!

Post by ViktorV » Tue 21 Nov 2017 07:54

1. SecureBridge does not have the specified restriction.
Unfortunately, we could not reproduce the issue.
Please check whether the issue is reproduced on our SSHClientApp demo project and inform us about the result.
Our SSHClientApp demo project demonstrating the use of the TScSSHShell component. You can find the SSHClientApp project in the% SecureBridgeDemos%\SSHClientApp directory. %SecureBridgeDemos% is the directory where SecureBridge Demo projects are installed on your computer.
2. You can get the OPEN FAILED error, if SSH server does not allow setting local port forwarding.

Post Reply