Page 1 of 1

"Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Thu 24 Aug 2017 06:31
by mchonedog
Hi guys,

I've downloaded the trail for SecureBridge, looking to do some automation of certain actions on our linux servers. I'm having a few issues when using a TScSSHShell component with the NonBlocking property set to false.

I've set the TScSSHClient to connect on FormShow and disconnect on FormDestroy, but when running the following code, it complains saying "Cannot send data to server". Works fine with NonBlocking set to true, but that doesn't fit my use case:

Code: Select all

function TForm3.ExecCmd(ACommand: string): string;
var
  sLine: string;
begin
  Result := '';
  ScSSHShell1.WriteString(ACommand + #13); // Blows up here
  repeat
    sLine := ScSSHShell1.ReadString;
    if (sLine <> '') then begin
      Result := Result + sLine;
    end;
  until (sLine = '');
end;

procedure TForm3.FormDestroy(Sender: TObject);
begin
  if (ScSSHClient1.Connected) then
    ScSSHClient1.Disconnect;
end;

procedure TForm3.FormShow(Sender: TObject);
begin
  if (not ScSSHClient1.Connected) then
    ScSSHClient1.connect;
end;
Image

The command I attempted to send was 'echo "Hello World"'.

Running Delphi 10.2 Tokyo (Update 1).

Thanks for the help in advance,

Michael.

Re: "Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Fri 25 Aug 2017 09:42
by ViktorV
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.

Re: "Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Fri 01 Sep 2017 04:03
by mchonedog
In that example you use the NonBlocking mode. It doesn't fit our use case.

Re: "Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Fri 01 Sep 2017 10:40
by ViktorV
Unfortunately, we cannot reproduce the issue. Both in the NonBlocking mode and without it, the error does not appear in our test environment.
Please, specify the exact version of the used SSH server.

Re: "Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Mon 04 Sep 2017 00:15
by mchonedog
We're using the latest version of sshd on our Linux Server. We are not using your SSH server component.

Server says: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016.

Re: "Cannot send data to server" using TScSSHClient (NonBlocking NOT enabled)

Posted: Tue 05 Sep 2017 12:33
by ViktorV
Unfortunately, we cannot reproduce the issue on your server version SSH.
To investigate the issue, please provide us test access to your server.