🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages Started by Jens Harms Sat, 29 Jan 2005 20:16
tidftp and tcgauge
#1482
Author: Jens Harms
Date: Sat, 29 Jan 2005 20:16
48 lines
2042 bytes
hi,

i am using the tidftp indy component for a download. i like to use a tcgauge
so display the staus of the download. here is my code for the onwork and
onworkbegin function:

void __fastcall TForm1::FTPWork(TObject *Sender, TWorkMode AWorkMode,
      const int AWorkCount)
{
 PBImages->Progress = AWorkCount;
 }
//--------------------------------------------------------------------------
-

void __fastcall TForm1::FTPWorkBegin(TObject *Sender, TWorkMode AWorkMode,
      const int AWorkCountMax)
{
 PBImages->MaxValue = AWorkCountMax;
 }
//--------------------------------------------------------------------------
-

bool __fastcall DownLoadFile(AnsiString remote, AnsiString target,
AnsiString folder1, AnsiString folder2)
{
   try
   {
      Form1->FTP->ChangeDir("\\");
      Form1->FTP->ChangeDir(folder1);
      Form1->FTP->ChangeDir(folder2);

      Form1->FTP->Get(remote, target,true, true);
   }
   catch(...)
   {
      return false;
   }
   return true;
}
//--------------------------------------------------------------------------
-

my download works fine, but the visualisation in the cgauge does not works.
the progress will be full after the first bytes arrived.

so why does this not works?

jens
Re: tidftp and tcgauge
#1483
Author: Remy Lebeau (TeamB)
Date: Sat, 29 Jan 2005 22:18
19 lines
1782 bytes
"Jens Harms" <jens@harms.ch> wrote in message
news:41fbef1b@newsgroups.borland.com...

> my download works fine, but the visualisation in the cgauge does
> not works. the progress will be full after the first bytes arrived.

The AWorkCountMax value in the OnWorkBegin event will always be 0.  A value
of 0 means that TIdFTP does not khow ahead of time how many bytes to expect
during the transfer.  This is not a bug in TIdFTP, the FTP protocol in
general does not provide that information to begin with.  You will have to
retreive the file's size separately before performing the transfer.  TIdFTP
has a Size() method for that.  Do note, though that not all FTP servers
support the SIZE command.  In those cases, you will have to retreive a
directory listing for the file instead and parse out the file size from
that.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads