(SOLVED) Is there anybody using FTP client (Indy ou Lnet) lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- sinfoni · 2010-06-24 05:04 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 · 2010-06-24 06:17 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 · 2010-06-24 06:34 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 · 2010-06-24 09:34 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;   After choose a file, get it.      Quote     FTP.Get( FileName , CurrDir+'\bk\'+FileName, False, False );      RenameFile := Filename + '.down';      FTP.Rename ( FileName, RenameFile );      FTP.Disconnect; ---------------------------------------------------------------------- sinfoni · 2010-06-25 23:27 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é. ---------------------------------------------------------------------- Almindor · 2010-07-03 13:31 What widgetset are you using with lNet/Lazarus? Are you using "visual" (the ones placed on form in visual editor) lNet components? If you're using the cocoa/carbon widgetsets lNet will not register network events. I don't own a mac and virtualbox still doesn't work properly with hackintosh so I can't make carbon interface hookup into lNet. If this is your case you must use the "non-visual" (TLTcp etc.) components directly from the lNet/lftp units and make a .CallAction call when possible to "look for events" on the sockets. (you can use a timer for this for example, or OnIdle). It's not the best solution on a visual project, but it'll work. ---------------------------------------------------------------------- sinfoni · 2010-07-03 15:55 As I said, I succed in making Lnet working. I don't use visual components because my processud is a daemon. The problem was that i forgot the OnControl trigger. Now the OnReceive fires when I call CallAction. Thanks