Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

asyncronous ftp client in MFC

Posted on 1998-09-20
4
Medium Priority
?
362 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
[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
  • 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

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. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

670 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