Solved

asyncronous ftp client in MFC

Posted on 1998-09-20
4
325 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries DB2 Query 2 98
Shell script to login to remote m/c and execute commands 10 79
string initialization in java 11 117
Thin secure Windows 10 5 108
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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