Solved

URGENT:How to implement a Progress Bar during FTP.

Posted on 1998-09-18
6
332 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

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

 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

617 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