Thank you for the guidelines!

2015-02-22 16:32 GMT+02:00 Lester Clayton <les...@lesterclayton.com>:

> I've writen an FTP client that previously used OnFtpProgress, and can
> confirm that it's called a tremendous amount of times, and in my case
> caused my client application to hit 100% CPU as a result.  The way I've
> implemented it in the past is to create another FTP Client class derived
> from ICS FTPClient, with an added timer which is turned on at the start of
> the transfer, and off at the end of the transfer, and every time the timer
> is fired (at intervals of say, 1000 ms), it updates the progress bar.
>
> Hope that helps with an efficient implementation.
>
> Lester
>
> On 22/02/2015 15:27, Angus Robertson - Magenta Systems Ltd wrote:
>
>> procedure TForm2.FtpProgress(Sender: TObject; Count: Int64;
>>>    var Abort: Boolean);
>>> begin
>>>     ProgressBar.Position := Count;
>>> end;
>>>
>> Correct concept, but you also need to set the ProgressBar Min and Max
>> properties to indicate how much progress has been made.
>>
>> The FTP event simply returns a count of the number of bytes transferred,
>> which
>> might be zero to several billion, so Min should be set to zero and Max to
>> the
>> size of the file being uploaded, before the upload starts.  Harder for
>> downloads where you need to know the size of the file first.
>>
>> Also, this event will typically be called dozens of times per second on a
>> fast
>> internet connection, and updating the screen is time consuming so can
>> slow down
>> the transfer speed, and the change may be invisible.
>>
>> So you generally put more intelligence in the progress function to update
>> no
>> more than once every one or more seconds or when there is a substantial
>> change,
>> like 1 to 5%.
>>
>> Angus
>>
>>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to