Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : TIdFTP Problems...

www.cryer.info
Managed Newsgroup Archive

TIdFTP Problems...

Subject:TIdFTP Problems...
Posted by:"Steve M" (maughancentral-djobs20..@yahoo.com)
Date:Mon, 28 Aug 2006 17:55:30

I'm having problems with TIdFTP - maybe someone could help.  I'm using D2006
Professional with the Indy components that come with the standard install
(10.1.5 I believe).  The code I'm using is below.  It basically just
connects, lists a directory and gets a file.  However sometimes (not
always?!?) I get a EIdReplyRFCError with mesasage "7: command not
understood.  Any idea what's going on?  Am I not closing the connection?
Should I have AutoLogin set to True?  Are there any basic demos that I can
use to just upload and download a file?

All help greatly appreciated!

Steve

// LOADING A FILE
      f := ''SOME_FILE.horizon';
      s := TStringList.Create;
      idFTP1.Disconnect;
      idFTP1.Host := '<xxxxx.xxxxx.xxxx>';
      idFTP1.Username := '<USERNAME>';
      idFTP1.Password := '<PASSWORD>';
      idFTP1.Connect;
      idFTP1.ChangeDir('Horizon');
      idFTP1.List(s);
      // Is there a new file to on the network
      if (s.IndexOf(f) >= 0) then
      begin
        idFTP1.Get(f, f, true);
       <DO SOMETHING WITH IT>
      end;
    finally
      idFTP1.Abort;
      idFTP1.Disconnect;
      idFTP1.Quit;
      s.Free;
    end;

//SAVING A FILE
    try
      idFTP1.Disconnect;
      idFTP1.Host := 'HOST'
      idFTP1.Username := '<USERNAME>';
      idFTP1.Password := '<PASSWORD>';
      idFTP1.Connect;
      idFTP1.ChangeDir('Horizon');
      idFTP1.Put(cParticipant.NormalFileName);
    finally
      idFTP1.Abort;
      idFTP1.Disconnect;
      idFTP1.Quit;
    end;

// COMPONENTS PROPERTIES
  with IdFTP1 do
  begin
    Name := 'IdFTP1';
    AutoLogin := True;
    Host := '<HOST>';
    Password := '<PASSWORD>';
    TransferTimeout := 20000;
    Username := 'USERNAME';
    ProxySettings.ProxyType := fpcmNone;
    ProxySettings.Port := 0;
    ReadTimeout := 5000;
  end;

Replies:

www.cryer.info
Managed Newsgroup Archive