Help for connect to Ftp Server lazarus / 43-Android ---------------------------------------------------------------------- magleft · 2023-07-17 09:37 On my computer I have created an ftp server through windows as shown in the file I am attaching. I managed to connect to the server from my mobile phone through an app. As can be seen in the program below, I tried to connect through an application to Laz4android, but I could neither connect nor download the file located in the server folder or copy a file from my mobile phone to the server. What am I doing wrong; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    Myftp:TFTPSend ; implementation  {$R *.lfm} uses   mimemess, mimepart, synautil, synachar; { TFenimerosi } procedure TFenimerosi.Button1Click(Sender: TObject);Function ConnectToFTP(url:String):Boolean;var  auser, apass, aport:String;Begin  auser :='';  apass:='';  aport:='21';  Myftp:=TFTPSend.Create ;    try       Myftp.UserName  := aUser;       Myftp.Password := aPass;       Myftp.TargetHost := url;       Myftp.TargetPort := aPort;       if not(Myftp.Login) then       begin          Result:=False;          Exit       end       Else         Result:=True;    Except          On Exception Do             Result:=False;    end;    Myftp.Free ;end; Procedure DownloadFTP(kode:Integer; URL, SourceFile, TargetFile: string);const  FTPPort='21';  FTPScheme='ftp://'; //URI scheme name for FTP URLsVar   i:Integer;   FileonAndroid, FileonWindows:String; begin   FileonAndroid :=self.GetEnvironmentDirectoryPath(dirDatabase)      +DirectorySeparator +'ApkAgros.db';   FileonWindows :='C:\Agrosftp\Agros.txt';    Try      showmessage(inttostr(kode),gvCenter,slLong);   if FtpGetFile (url,'21',SourceFile ,TargetFile ,'','') then      showmessage('succes'+inttostr(kode),gvCenter,slLong)   else     Showmessage('fail'+inttostr(kode),gvCenter,slLong);   Except         On Exception Do         begin            Showmessage('Exception'+inttostr(kode),gvCenter,slLong);            exit;         end;   end;end; const  FTPPort='21';  FTPScheme='ftp://'; //URI scheme name for FTP URLsvar  i:Integer;  FileonAndroid, FileonWindows:String;  url,urlname:String; begin  url:='192.168.2.11';  urlname:='MyFTP';  FileonAndroid :=self.GetEnvironmentDirectoryPath(dirDatabase)     +DirectorySeparator +'ApkAgros.db';  FileonWindows :='C:\Agrosftp\Agros.txt';  if ConnectToFTP(url) then     showmessage('Connect') else showmessage('Not Connect');  DownloadFTP(1,url,FileonAndroid,FileonWindows);  DownloadFTP(2,urlname,FileonAndroid,FileonWindows);  DownloadFTP(3,url,FileonWindows,FileonAndroid);  DownloadFTP(4,urlname,FileonWindows,FileonAndroid);  url:=FTPScheme +url;  urlname :=FTPScheme +urlname ;  if ConnectToFTP(url) then     showmessage('Connect with Scheme') else showmessage('Not Connect with Scheme');  DownloadFTP(5,url,FileonAndroid,FileonWindows);  DownloadFTP(6,urlname,FileonAndroid,FileonWindows);  DownloadFTP(7,url,FileonWindows,FileonAndroid);  DownloadFTP(8,urlname,FileonWindows,FileonAndroid); end; ---------------------------------------------------------------------- Mongkey · 2023-07-18 05:44 Have you ever tried with built in ftp component for android?? It works well on plain ftp. Just give a try. Thank you. ---------------------------------------------------------------------- magleft · 2023-07-19 11:32 I assume you mean FTPClient1/SFTPClient1. I have already tried it but to no avail. What could be wrong? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFenimerosi.Button2Click(Sender: TObject);begin  FTPClient1.Host :='192.168.2.11';  FTPClient1.Port :=21;  FTPClient1.Username :='';  FTPClient1.Password :='';  FTPClient1.Connect();end; procedure TFenimerosi.FTPClient1Connect(Sender: TObject; success: boolean);begin   if success then   begin    FTPClient1.WorkingDirectory :=path_net ;    IsConnected:= True;    ShowMessage('success');    ShowMessage('Server WorkingDirectory: ' +FTPClient1.WorkingDirectory);   end   else   begin     IsConnected:= False;     ShowMessage('Sorry.... not connect...');   end;end; ---------------------------------------------------------------------- Mongkey · 2023-09-15 11:31 You need take a look more at ftp demo at GUI folder Thank you