🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
12 messages
12 total messages Started by Carl Danley Mon, 25 Jun 2007 03:37
Need Assistance with the TIdFTP Component in BCB 2006...
#1010
Author: Carl Danley
Date: Mon, 25 Jun 2007 03:37
12 lines
1652 bytes
So, I am developing an application that allows users to upload files to a 
website using the TIdFTP component in the Indy 9 Client Component 
Category... I was wondering if anyone knew how to display the current 
transfer process on a Label... Example: "9287 bytes of 9847224 bytes 
uploaded"... I knew how to implement this in Borland C++ Builder 4.0... I 
would use coding like:

Label1->Caption = ftp->BytesTransferred+" bytes of "+ftp->TotalBytes+" bytes 
uploaded";

I dont know how to display the status with the new component in Borland C++ 
Builder 2006... I need help... please! 
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1012
Author: Remy Lebeau (TeamB)
Date: Mon, 25 Jun 2007 14:28
11 lines
1243 bytes
"Carl Danley" <cdanley@codebyter.com> wrote in message
news:467f387d$1@newsgroups.borland.com...

> I was wondering if anyone knew how to display the current
> transfer process on a Label...

Use the OnWorkBegin, OnWork, and OnWorkEnd events.


Gambit
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1013
Author: Remy Lebeau (TeamB)
Date: Mon, 25 Jun 2007 14:31
24 lines
1761 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:9vnv73dl97vfkq2qqs8spvb1ermjvjkgsu@4ax.com...

> Before uploading, you get the file size from the operating system.

You do not need to do that for uploads.  TIdFTP already knows the size
of the file it is uploading, and provides that in the AWorkCountMax
parameter of the OnWorkBegin event.

> In the OnWork() member, you add each AWorkCount to your running
total

That is not correct.  AWorkCount is already the total running count.
Use it as-is.

> use Synchronize() to update the label.

TIdFTP is not a threaded component, so that is not necessary if it is
already being used in the main thread.  Synchronize() is only needed
if you are using TIdFTP in a worker thread.


Gambit
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1011
Author: Bob Gonder
Date: Mon, 25 Jun 2007 15:36
18 lines
1945 bytes
Carl Danley wrote:

>So, I am developing an application that allows users to upload files to a 
>website using the TIdFTP component in the Indy 9 Client Component 
>Category... I was wondering if anyone knew how to display the current 
>transfer process on a Label... Example: "9287 bytes of 9847224 bytes 
>uploaded"... I knew how to implement this in Borland C++ Builder 4.0... I 
>would use coding like:
>
>Label1->Caption = ftp->BytesTransferred+" bytes of "+ftp->TotalBytes+" bytes 
>uploaded";
>
>I dont know how to display the status with the new component in Borland C++ 
>Builder 2006... I need help... please! 

Before uploading, you get the file size from the operating system.
In the OnWork() member, you add each AWorkCount to your running total,
and use Synchronize() to update the label.
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1014
Author: Minas
Date: Mon, 25 Jun 2007 17:24
13 lines
1352 bytes
? "Carl Danley" <cdanley@codebyter.com> wrote:

> So, I am developing an application that allows users to upload files to a 
> website using the TIdFTP component in the Indy 9 Client Component

this may help you

http://bcbjournal.org/forums/viewtopic.php?t=466

_Minas Harokopos

------
"Only the virtue's conquests have certainty" Sofokleous Erephyle 
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1016
Author: Remy Lebeau (TeamB)
Date: Mon, 25 Jun 2007 18:57
22 lines
1665 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:r410831ej119vgkah9l8uvs2ahdj7msecc@4ax.com...

> But you still need to remember it yourself, right?

Usually yes, since you are going to use it in a display or a
percentage calculation.

> OP was saying the value persisted (as a property?) in the old
library.

The "old library" he was referring to was the NetMaster components
that Borland used to bundle with the IDE before switching over to
Indy.

> Ok then the BDS2006 documentation is incorrect

Yes, it is.


Gambit
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1015
Author: Bob Gonder
Date: Mon, 25 Jun 2007 18:58
36 lines
2506 bytes
Remy Lebeau (TeamB) wrote:
>"Bob Gonder"  wrote in message
>
>> Before uploading, you get the file size from the operating system.
>
>You do not need to do that for uploads.  TIdFTP already knows the size
>of the file it is uploading, and provides that in the AWorkCountMax
>parameter of the OnWorkBegin event.

But you still need to remember it yourself, right?
OP was saying the value persisted (as a property?) in the old library.

>> In the OnWork() member, you add each AWorkCount to your running
>total
>
>That is not correct.  AWorkCount is already the total running count.
>Use it as-is.

Ok then the BDS2006 documentation is incorrect

AWorkCount	Number of bytes affected by the event

This is inside the OnWork Event, so the number of bytes per event seems to be the meanng
as prior bytes (and their events) are not affected by this particular event.

AWorkCount indicates the number of bytes sent or received in the read or write operation

Should have the word "Total" in there somewhere.

If you've already fixed the docs, it might be nice if CG hotfixed our help docs.

Feature Suggestion:
OnWork supply similar data as CopyProgressRoutine does for CopyFileEx.
(I realize I'm over a year late on that, but it just came up)
That's quite a bit of work too, I'd imagine as everything seems to go through OnWork
Maybe version11....
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1026
Author: Carl Danley
Date: Wed, 27 Jun 2007 20:09
27 lines
1820 bytes
Alright, now I am trying to update the CGauge1 that I have used for the 
status bar on file transmission... The cgauge performs as expected when I 
upload the file and it will display the correct information, but upon 
downloading a file it will not perform at all... The CGauge is displaying 
100% at all times... The Code under my functions is as follows:

ftpWorkEnd()
{
 pbar->Progress = 0;
 ListBox1->Height = 329;
 ListBox1->Repaint();
 pbar->Visible = false;
}

ftpWorkBegin()
{
  pbar->Progress =0;
  pbar->MaxValue = AWorkCountMax;
}

ftpWork()
{
  pbar->Progress = AWorkCount;
}

..... Am I doing something wrong that this wont display the download 
progress? 
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1027
Author: Bob Gonder
Date: Thu, 28 Jun 2007 02:41
16 lines
1496 bytes
Carl Danley wrote:

>ftpWorkBegin()
>{
>  pbar->Progress =0;
>  pbar->MaxValue = AWorkCountMax;
>}
>..... Am I doing something wrong that this wont display the download 
>progress? 

Check   AWorkCountMax.
I figure it's zero, making the progress bar always 100%.
Remy mentioned some time ago that Get doesn't know the size of the file.
If that is still the case, then you would need to figure the file size before downloading.

I can't find the Indy function, but the Win function is  FtpFindFirstFile().
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1028
Author: Remy Lebeau (TeamB)
Date: Thu, 28 Jun 2007 03:21
24 lines
1769 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:8l7683p0biqji92gqsm17hane1hdm6kd7q@4ax.com...

> Remy mentioned some time ago that Get doesn't know
> the size of the file.

Correct.  The FTP specification does not provide any means of
specifying the file size during a transfer.

> If that is still the case

It is.

> then you would need to figure the file size before downloading.

Correct.  TIdFTP has a Size() method for that, though not all servers
support the SIZE command as it was not part of the original FTP
specification.  So if Size() returns -1, then you will have to use the
List() method with the DirectoryListing property to grab information
about the file.


Gambit
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1029
Author: Carl Danley
Date: Thu, 28 Jun 2007 05:56
16 lines
1949 bytes
> Correct.  TIdFTP has a Size() method for that, though not all servers
> support the SIZE command as it was not part of the original FTP
> specification.  So if Size() returns -1, then you will have to use the
> List() method with the DirectoryListing property to grab information
> about the file.
>
>
> Gambit

If size does not work correctly then I need to use the List() and 
DirectoryListing property to grab information about the file... How do I do 
that with the DirectoryListing Property?? If you have some kind of sample 
that would be perfect... This FTP stuff is still a section I am trying to 
get down solid...

p.s. - All of your time is Greatly appreciated! 
Re: Need Assistance with the TIdFTP Component in BCB 2006...
#1030
Author: Remy Lebeau (TeamB)
Date: Thu, 28 Jun 2007 08:34
17 lines
1575 bytes
"Carl Danley" <cdanley@codebyter.com> wrote in message
news:46834d95$1@newsgroups.borland.com...

> How do I do that with the DirectoryListing Property??

Have you tried looking at it yet?  Have you read the documentation for
it yet?  It is a very straight-forward collection to use.

> If you have some kind of sample that would be perfect...

Have you looked at the downloadable demos from Indy's website yet?  Or
gone to http://www.deja.com to search through the newsgroup archives?
Code snippets have been posted many many times before.


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