I'm trying to make a connection for Android in FMX project. When I do:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
ScSSHClient1.Connected := True;
ScSSHChannel1.Connected := True;
if ScSSHChannel1.Connected then Label1.Text := 'Connected'
else Label1.Text := 'Not Connected'
end;
an error "Object not found" occurs in the procedure:
Code: Select all
procedure TForm1.ScSSHClient1ServerKeyValidate(Sender: TObject;
NewServerKey: TScKey; var Accept: Boolean);
var
Key: TScKey;
fp: string;
begin
ScFileStorage1.Path := TPath.GetDocumentsPath; // Папка на Android
Key := ScFileStorage1.Keys.FindKey(ScSSHClient1.HostName);
if (Key = nil) or not Key.Ready then begin
NewServerKey.GetFingerPrint(haMD5, fp);
NewServerKey.KeyName := ScSSHClient1.HostName;
ScFileStorage1.Keys.Add(NewServerKey);
Accept := True;
end;
end;
Code: Select all
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
Uni, ScSSHChannel, ScSSHClient,
ScBridge, CRVio, ScUtils, FMX.StdCtrls, FMX.Controls.Presentation,
System.IOUtils;
type
TForm1 = class(TForm)
ScFileStorage1: TScFileStorage;
ScSSHClient1: TScSSHClient;
ScSSHChannel1: TScSSHChannel;
Button1: TButton;
Label1: TLabel;
procedure ScSSHClient1ServerKeyValidate(Sender: TObject;
NewServerKey: TScKey; var Accept: Boolean);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
{$R *.LgXhdpiPh.fmx ANDROID}
procedure TForm1.ScSSHClient1ServerKeyValidate(Sender: TObject;
NewServerKey: TScKey; var Accept: Boolean);
var
Key: TScKey;
fp: string;
begin
ScFileStorage1.Path := TPath.GetDocumentsPath; // Папка на Android
Key := ScFileStorage1.Keys.FindKey(ScSSHClient1.HostName);
if (Key = nil) or not Key.Ready then begin
NewServerKey.GetFingerPrint(haMD5, fp);
NewServerKey.KeyName := ScSSHClient1.HostName;
ScFileStorage1.Keys.Add(NewServerKey);
Accept := True;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ScSSHClient1.Connected := True;
ScSSHChannel1.Connected := True;
if ScSSHChannel1.Connected then Label1.Text := 'Connected'
else Label1.Text := 'Not Connected'
end;
end.