Re: OnAfterClientLogin

Giganews Newsgroups
Subject: Re: OnAfterClientLogin
Posted by:  Remy Lebeau (TeamB) (gambit…@yahoo.com)
Date: Wed, 17 Sep 2003

"Dan" <da…@thesourceintl.com> wrote in message
news:E6E9D21B1D7FE240da…@thesourceintl.com...
> I am trying to have my app login to the ftp server, then change
> to the appropriate directory than transfer files all without any
> user intervention. I have found the only event that occurs when
> after the user logs in, is the onafterClientLogin event.

You need to unlearn what you have learned about VCL components when dealing
with Indy.  You do not need to use any events at all to do what you are
asking for.  Indy is not an event-driven library, its events are primarily
meant for status purposes only.  Indy is a blocking library, all operations
block the calling thread until the operations have been completed.  This
allows Indy to be programmed in a very linear fashion.

> When I try to changedir() within the event, I get the error
> "unable to build data connection, no route to host".

Do not use any event for that.  Simply call ChangeDir() after Connect()
returns:

    IdFTP1.Connect(True);
    try
        IdFTP1.ChangeDir('some folder');
        IdFTP1.Get('somefile.ext', 'c:\somefile.ext', True, False);
    finally
        IdFTP1.Disconnect;
    end;

Gambit

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03

Replies

In response to

OnAfterClientLogin posted by Dan on Tue, 16 Sep 2003