Solved

URGENT:How to implement a Progress Bar during FTP.

Posted on 1998-09-18
6
322 Views
Last Modified: 2013-11-20
Hi Experts,

I want a progress bar should be displayed while File Transfer.

Also I need to step the Progress bar relative to the transfer rate during FTP.

Regards
Lakshmi
0
Comment
Question by:lakshmi083198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:umarama
ID: 1322317
Are you using CFtpConnection ? Or you have your own class to FTP?

Are you downloading or uploading the file ? Basically, do you know what is the size of the file you are working with ?

Working with CProgressCtrl is very easy once you have the desired range. As for FTP, you can work with callbacks to get the size of file downloaded/uploaded. This info can be used to increment the position of progress ctrl.



0
 

Author Comment

by:lakshmi083198
ID: 1322318
Thanks Uma,

Yes I am using CFtpConnection.

I am Uploading and Downloading files.

Actually I have implemented progressBar by specifying its range as the total number of files to be Down/up loaded and stepping once after each file has been transfered.
But I need to implement the Progress Bar by calculating the Transfer rate.(ie kb/sec).

0
 
LVL 1

Expert Comment

by:saneesh100
ID: 1322319
Hi Lakshmi..

  I think u need to find the data transfer rate actually. say file xx.cpp 25 % send at 4000 bytes/sec . AM i right ? The first thing is that it will vary a lot during the transmission. As u know t will depeneds upon the network traffic . Actually i haven't used with CFtpConnection .But i used WININET function which are same .You can specify a call back function in which it will give the data transfered etc.. By including a variable for time and computing the difference between each time the callback fn occurs u can easily calculate the time . To get more accurate results u have to go down to socket level but u have to implement the ftp using the help of relevant RFC .It will be more steady .

 If u cna give me u'r email ID i can give u a sample program to do this..
                            *********** Best of luck ************

                                            saneesh8@hotmail.com
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
umarama earned 50 total points
ID: 1322320
Say you have five files to download. A-300KB B-200KB C-100KB D-600KB and E-450KB. Currently your progress ctrl increments 5 times. And you wish to indicate to the user how much out of (300+200+100+600+450 = 1650KB) you have downloaded. Hence you are mentioning that you need to implement the Progress Bar by calculating the Transfer rate.(ie kb/sec). Yes ?

If what I understood is correct, then the solution involves you not to use GetFile() or PutFile() which does all the work for you. You take the extra trouble of using OpenFile() which gives you the CInternetFile.

Taken from Documentation of OpenFile ....
"Use OpenFile when
An application needs a fine level of control over a file transfer. For example, the application may want to display a progress control indicate the progress of the file transfer status while downloading a file.
After calling OpenFile and until calling Close, the application can only call CInternetFile::Read, CInternetFile::Write, Close, or CFtpFileFind::FindFile. Calls to other FTP functions for the same FTP session will fail and set the error code to FTP_ETRANSFER_IN_PROGRESS. "

Do read the rest of the documentation. Let me know if this solves your problem.


0
 
LVL 1

Expert Comment

by:polimetla
ID: 1322321
Dear lakshmi,

just i am giving my idea.
0. start the downloading of required file abc.txt . and set the timer to 0.
1. in equal intervals find the size of file abc.txt.
2. comapare with original size and find the rate of transfer rate.
3. according to that set the progress bar.

with regards,
Bhavani P Polimetla.

0
 
LVL 2

Expert Comment

by:dbusher
ID: 5698888
I use GetFile()   and would like to implement a progress bar But I want to show progress for each individual file (one at a time).  I can't seem to figure it out!! Can someone send me an example of how to do this?!!  Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question