Solved

URGENT:How to implement a Progress Bar during FTP.

Posted on 1998-09-18
6
310 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
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now