Solved

asyncronous ftp client in MFC

Posted on 1998-09-20
4
299 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

Free Trending Threat Insights Every Day

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

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 166
fizzArray  challenge 1 47
wordappend challenge 8 85
Problem to event 3 50
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

22 Experts available now in Live!

Get 1:1 Help Now