Solved

asyncronous ftp client in MFC

Posted on 1998-09-20
4
311 Views
Last Modified: 2013-11-19
I need to write an MFC app that transfers a few files via ftp to local harddisk. i.e. an ftp client. It doesn't need fancy interfaces, just a basic IP or name + file&path.

Point is : it should be done asyncronously, and FULLY interuptable !

the question :
is there an sample code out there that shows me how to do this in MFC ??
0
Comment
Question by:loesje
  • 2
4 Comments
 

Expert Comment

by:umarama
ID: 1322343
Use CFtpConnection with CInternetSession. For file listing, use CFtpFileFind class. For asynchronous transfer (which is recommended by MFC), use it's callback functionality which will enable you to interrupt the transfer whenever you decide to.

In fact, please look into the various WinInet classes provided by MFC. The documentation has sample code to do basic operations. Check out the FTPTREE sample. It should clear out many of your initial inhibitions.

All the best.
0
 

Author Comment

by:loesje
ID: 1322344
oops...

ftptree does NOT give sample code in downloading. It just shows you how to connect and get remote directory listings.

also, ftptree does NOT allow you to interrupt the running download

also, CFtpConnection and CInternetSession are WinInet calls... I was wondering : do those calls work if the user does not have ActiveX installed ???

What does a client machine exactly need to run programs based on CFtpConnection and CInternetSession calls ????


jeroen
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1322345
The client needs WININET.DLL to be installed for those classes to work.

B ekiM

0
 

Accepted Solution

by:
umarama earned 100 total points
ID: 1322346
Yes. FTPTREE provides directory listing only. I suggested that to you so that you get to know how to use the WinInet classes.
Also, please go thru the class interfaces provided.
GetFile() & PutFile() - the basic FTP commands - wrappers are provided ! This does everything for you if you just want to download.

Now if you want fine control over the transfer, (FULLY interuptable ) Use OpenFile()and use the CInternetFile to interrupt as and when you need.
REFER "Steps in a Typical FTP Client Application" documentation.
It's pretty straightforward.

And yes, for callback to be effective, you will have to derive from CInternetSession. Override OnStatusCallback().

As Mikeblas put it, you will require the WININET.DLL.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 34
if loop in java 3 142
haveThree challenge 22 118
Execute multiple curl cmds with sleep and send output to file 10 97
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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