Delphi + nsoftware sshclient how to send command to device?

147 Views Asked by At

I'm trying to send command via SSH to Router using nsoftware SSHClient:

procedure TForm1.Button2Click(Sender: TObject);
begin
 iphSSHClient1.Connected:=true;
 iphSSHClient1.OpenChannel('session');//channel id is 0
 iphSSHClient1.StartService('0','shell','');
 iphSSHClient1.OpenTerminal('0', 'vt100', 480, 640, false, '350000000000');
end;

When running code I got error 1033: "could not open vt100 terminal for channel [0]" Then I tried to create two channels:

procedure TForm1.Button2Click(Sender: TObject);
begin
 iphSSHClient1.Connected:=true;
 iphSSHClient1.OpenChannel('session');//channel id is 0
 iphSSHClient1.OpenChannel('session');//channel id is 1
 iphSSHClient1.StartService('0','shell','');
 iphSSHClient1.OpenTerminal('1', 'vt100', 480, 640, false, '350000000000');//here is use channelid 1
end;

The code run but is that correct way? and how to send command data to device, I tried:

iphSSHClient1.SendChannelData('1',TEncoding.UTF8.GetBytes('ls'#13));

With the setup package from nsoftware there is no example how to use SSHCLient, any help?

WARNING: your terminal doesn't support cursor position requests (CPR), How to solve that?

Thank you,

0

There are 0 best solutions below