Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

URGENT:How to implement a Progress Bar during FTP.

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
lakshmi083198
Asked:
lakshmi083198
1 Solution
 
umaramaCommented:
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
 
lakshmi083198Author Commented:
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
 
saneesh100Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
umaramaCommented:
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
 
polimetlaCommented:
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
 
dbusherCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now