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

x
?
Solved

asyncronous ftp client in MFC

Posted on 1998-09-20
4
Medium Priority
?
378 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

885 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