Forum > Networking and Web Programming
(SOLVED) Is there anybody using FTP client (Indy ou Lnet)
sinfoni:
Hi all,
I'm trying to make a console program (Mac OS X) which has to download a file from a FTP server. I've tried Indy and Lnet. With both, I just get empty file (0 kb).
Of course I have verified that the file to download is present, etc. I can download it using FileZilla with same host, user and password.
Any Idea ?
André
skalogryz:
sinfoni, the example code (using LNet) would be useful.
I've written once a simple MacOSX FTP client front-end for external 'ftp' tool. Quite cheap solution :)
sinfoni:
Yes, it's ok. :) As I've began my FTP client using Indy, then Lnet because of Indy does not work, but still get empty file, I thought the... truth was out there.
I've compiled and used successfully the Lnet ftp example, and now, mine is also ok.
Thanks.
fredycc:
Hi, this is a little piece of code, thats download a file from a ftp server. This works with Indy 10.2.0.3, I have test this in linux and windows, and works.
First, obtaint the list of files, in this case zip, only.
--- Quote ---
FTP := TIdFTP.Create( nil );
FTP.Username := 'user123';
FTP.Password := 'pas123';
FTP.Host := 'xxx.xxx.xxx.xxx';
try
aLog('Intentando conectar para recuperar lista de archivos...');
FTP.Connect;
aLog('Conexión establecida.');
except
aLog(DateTimeToStr(Now) + ' No se logro establecer la conexión con el servidor FTP.');
FTP.Free;
Terminate;
end;
FTP.ChangeDir( '/myfiles/' );
FTP.List('*.ZIP',true);
numFiles := FTP.DirectoryListing.Count;
SetLength(aFilesftp, numFiles);
for I:= 0 to numFiles - 1 do
aFilesftp := FTP.DirectoryListing.Items.FileName;
FTP.Disconnect;
--- End quote ---
After choose a file, get it.
--- Quote --- FTP.Get( FileName , CurrDir+'\bk\'+FileName, False, False );
RenameFile := Filename + '.down';
FTP.Rename ( FileName, RenameFile );
FTP.Disconnect;
--- End quote ---
sinfoni:
Thanks redycc, but IdFTP definitly doesn't work with Mac OS X.
Note that the IdHttp component has also some problems with Mac OS X. I use it, but I have to free it then recreate it before each connexion, otherwise an exception occurs.
Indy is very unstable for this platform. Moreover, it's annoying, but IdFTP component triggers exception on success. I can't understand this behavior (neither agree with it).
I still use it only for windows/delphi environment.
André.
Navigation
[0] Message Index
[#] Next page