API

Giganews Newsgroups
Subject: API
Posted by:  API (ari.pikivir…@kolumbus.fi)
Date: Tue, 6 Mar 2007

this might be dummy question, but i'll ask anyway - -
i started to play around with indy ftp client (indy 10.1.6)
and tried to add new thread for the long taking downloads
or uploads as follows:

    sl:= tstringlist.create;
    newftp:= tidftp.Create(self); // create additional client
    try
      ConnectNewFtp(idftp1, newftp); // try connect with exactly same
original parameters
      sl.clear; // clear temp list
      for i:=0 to api_listbox1.Items.Count-1 do // go trough all items
        if api_listbox1.Selected[i] then // if selected
          sl.add(api_listbox1.getcolvalue(i,0)); // add directory name
      if sl.count>0 then // if any selected found
        for i:=0 to sl.count-1 do // go trough selected
        try
          if newftp.Connected then // new client was succesfully connected
            u_ftptools.DownloadFtpDirectory(newftp, target, sl[i]) //
download folder with subs
            else u_ftptools.DownloadFtpDirectory(idftp1, target, sl[i]); //
download folder with subs
        except
          on e: exception do
          begin
            messagedlg(e.Message, mterror, [mbok], 0); // show error that
were raised
            break; // break loop, we don't want to download more dirs
          end;
        end;
    finally
      sl.free; // free temporary list of dir names
      newftp.free; // free new client created for these download(s)
    end;

it works, but is there some OTHER way of creating new connect for
the downloads that doesn't stop the main ftp client?

lets assume that the "DownloadFtpDirectory" is transferring stream,
how would i break the download while on that phase (idftp.get);
is it possible to just raise exception to the newftp created?

Replies