Delphi connection trouble - WeOnlyDo Discussion board

Delphi connection trouble (wodSSH / wodSSH.NET)

by John, Wednesday, August 09, 2006, 05:39 (6479 days ago)

I seem to have trouble connecting to OpenSSH. I have tried every possible combination for the second parameter in the execute method, but none of them work, including the suggested regex. The program always times out after 1 second (I set it to 1 second) and the script I'm trying to execute is never actually executed. I am using the latest licensed version of wodSSH as of about four days ago. The send method appears to work fine, but I need execute with blocking because I'm going to be sending some data back to the client.

here's the prompt:
[root@localhost ~]#

procedure TForm1.Button1Click(Sender: TObject);
begin
bExec := False;

wodSSH1.Hostname := Edit1.Text;
wodSSH1.Login := Edit2.Text;
wodSSH1.Password := Edit3.Text;
wodSSH1.Protocol := ComboBox1.ItemIndex;

if ComboBox1.ItemIndex = 1 then wodSSH1.Port := 23; // for telnet
if ComboBox1.ItemIndex > 1 then wodSSH1.Port := 22; // for SSH


memo1.Text := '';
PrintList('Connecting...' + chr(13) + chr(10));

wodSSH1.Blocking := True;
wodSSH1.Connect;

end;

procedure TForm1.wodSSH1Connected(Sender: TObject; ErrorCode: Smallint;
const ErrorText: WideString);
begin
if ErrorCode<>0 then
printlist('CONNECT error: ' + ErrorText + chr(13) + chr(10))
else
printlist('CONNECTED to ' + wodssh1.Hostname + chr(13) + chr(10));

wodSSH1.Execute('/root/create.sh aa.txt john000 u3277fhg59njmjv7y56nh' + #10, '[root@localhost ~]# ', 1)

end;


Complete thread: