Click here to Skip to main content
Click here to Skip to main content

FTP Wanderer - FTP Client using WININET

By , 30 Jul 2002
 

Sample Image

Description

This article presents a fully functional implementation of a FTP client. FTP Wanderer is a multithreaded FTP client with the look-and-feel of Windows Explorer, and makes moving files between the Internet and your computer as simple as local file manipulation. This application uses WININET API's to handle the FTP protocol, and while it's not the most elegant way to connect to a FTP server it does the job pretty well.

Features list

  • All file transfer requests are handled in the background, so you don't have to wait while files copy to continue browsing the current server. You can even connect to a different server, while file transfers on another server are still in progress.
  • The Transfer Manager shows all file transfers currently in progress plus the ones that are in the queue. You can configure how many transfers are processed simultaneously, so you don't run out of resources.
  • FTP Wanderer uses the Windows 9x/NT/XP style list boxes for displaying the contents of remote servers. With all familiar system icons and context menus.
  • You can specify the number of times it should try to connect, and the time delay between connection attempts.
  • Full Drag and Drop support. Simply drag one or more files or even complete folders onto FTP Wanderer's file view area to transfer them to the location of the server that is currently connected.
  • Easily configure FTP site settings, like username, password, port, initial remote folder, number of retries and default download folder.

Here's a brief description of some of the important classes of the application:

CMainFrame

CMainFrame contains most of the code for managing the FTP connection. It takes care of connecting to the server; initiate up/downloads and handling other FTP related actions.

CFTPListView

This is just a CListView derived class that takes care of displaying the files and enabling you to sort them. When the application is busy downloading or sorting a directory listing it can display an animation, just like explorer does.

CConnectDlg

This class (= Site Manager) enables the user to manage FTP sites. You can add/change and delete sites and configure properties such as hostname, port, username and password. The settings of each site are save to disk using serializing.

CTransferManagerDlg

CTransferManagerDlg (= Transfer manager) takes care of queuing the file transfers. It shows all file transfers currently in progress plus the ones that are in the queue. You can configure how many transfers are processed simultaneously, so you don't run out of resources. Each up/download in handled in a separate thread by initiating a CDownloadThread or CUploadThread thread.

CDownloadThread

Each download is handled in the background using a separate thread. CDownloadThread creates a new connection with the FTP server and displays a progress dialog that tells you the status of the file transfer. When the download is completed (or aborted) it notifies the transfer manager so the UI can be updated.

CUploadThread

Each upload is handled in the background using a separate thread. CUploadThread creates a new connection with the FTP server and displays a progress dialog that tells you the status of the file transfer. When the upload is completed (or aborted) it notifies the transfer manager so the UI can be updated.

To do list:

While this application has most of the features you might expect in a FTP client, there are a few things left to do:

  • Drag and drop support out of the file view area to Explorer. I think this one is not that easy, because this would probably 'block' explorer until the file transfer is completed (any suggestions?).
  • Progress indication in the transfer manager. This is not really that hard to do, so this will probably be in the next release.
  • Better asynchrony handling of getting directory listing. The UI now does not respond when downloading a huge directory listing.

Contacting the Author

Please send any comments or bug reports to me via email. For any updates to this article, check my site here.

Revision history

  • 31st July 2002 - Initial revision.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Pablo van der Meer
Web Developer
Netherlands Netherlands
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionbug: assertion occursmemberbln13fb4 Mar '13 - 23:07 
debug mode:
 
ASSERT(nID == 0 || ::IsWindow(hWndCtrl));
 
assertion occurs
GeneralMy vote of 5memberytfrdfiw31 Oct '12 - 21:51 
a good article and source code
Questionhow to debug and compile in vs2008memberytfrdfiw31 Oct '12 - 21:51 
This project works fine in vc++6.0;but at vs2008,it can't works ok.it can't debug,compiling and linking only if you change same setting.
 
Can any one help me?
ytfrdfiw

Generalc# or VBmemberMember 397598029 Oct '09 - 7:16 
Is this project in c# o in ASP.NET or in VB.NET??? It will be fantastic
Questionhow to mark when a download is finishedmemberflyras22 Aug '09 - 23:01 
i'm trying to embed HTML editing to FTP wanderer. The problem is, when i call the editing dialog (after the file has been downloaded to a temp folder), it usually opens before the temp download has finished. Any ideas on how to tell my function when a download actually finishes?
GeneralA comfortable FTP class in .NETmemberElmue27 Aug '08 - 12:15 
Hello
 
If you search a comfortable and reusable FTP client,
 
-- which is running on .NET Framework 1.1 or higher,
-- which can automatically put together splitted files on the server,
-- which allows to download only a part of a file on the server,
-- which allows to resume any broken download,
-- which automatically starts a separate thread,
-- which can be aborted any time from your main thread,
-- which supports UTF8 encoded filenames,
-- which has a built-in download scheduler,
-- which has a built-in bandwidth control,
-- which has a built-in preview function for the download of movies,
-- which automatically reconnects the server after an error has occurred,
-- which displays download progress in percent and in bytes and the remaining time,
-- which writes a detailed logging for all operations it does,
-- which is based on Wininet.dll and has one workaround for each of the 4 known Wininet.dll bugs,
-- which is very well tested and bug-free,
-- which is written by a very experienced programmer and has a very clean and well documented sourcecode,
 
then have a look at this project:
 
ElmueSoft Partial FTP Downloader[^]
 

Elmü
QuestionQuestionmemberAlireza_136210 Feb '08 - 21:44 
How i can Make a HTTP connect?
QuestionCInternetSession Setting problemmemberCem Usta17 Aug '07 - 2:20 
Hi Pablo,
 
First of all, thx for this great project.
 
I am having problem with my MFC/WinInet project which is doing ftp connections. I cannot change its timeout durations. I tried lots of things but connection timeout is always 20 seconds. WTF | :WTF:
 
So I downloaded and compiled your project; In FTP Wanderer you set default timeout value to 30 seconds if there is no timeout duration set at registry. So I set up a connection which will drop into timeout. when I start connection, it drops into timeout when 20 seconds passed ( not 30 seconds which is set within program ). Confused | :confused:
 
I downloaded and tried many opensource WinInet FTP project to test this, all of them dropped into timeout at 20 seconds; not the timeout value set in project.
 
Is there a possibility of WinInet having a bug within CInternetSession.SetOption() timeout values? Confused | :confused:
 
Regards,
Cem.
Questiontwo errors when i compline the source use visual studio 2005?memberxinmans13 Apr '07 - 0:02 
------ Build started: Project: FTPWanderer, Configuration: Debug Win32 ------
Compiling...
StaticLink.cpp
f:\课件_实验\ftpwanderer\staticlink.cpp(42) : error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CStaticLink::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)'
            Cast from base to derived requires dynamic_cast or static_cast
Build log was saved at "file://f:\课件_实验\FTPWanderer\Debug\BuildLog.htm"
FTPWanderer - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

GeneralGreat Job !!! Hats offmembersridharraov22 Feb '07 - 4:09 
Dude Thanks a lot.
GeneralDrag and Drop Problemmembercodepanter25 Sep '06 - 23:35 
When i drag and drop a folder containing files to a server..files are not getting uploaded...help meBlush | :O
GeneralThis might be the greatest article on this sitememberProgramm3r22 Aug '06 - 20:39 
Pablo,
 
Awesome ..... I don't think .... I can say anymore .... Thanx for sharing this.. Smile | :)
 

 
Regards
 
Programm3r

Generalwow...memberjimbo_azim12 Jul '06 - 22:10 
your ftp wanderer is superb..and almost perfect...u r the man..good job..thanx for helping people like me..adioz man
QuestionWinInet FTP - how to dump each conversation ?memberrrrado30 Nov '05 - 4:21 
Is it possible to use WinInet FTP and scroll in some window exact communication ? I mean whole ftp commands and responses ?
 
Thanks!
 

rrrado
QuestionHow to implement security in FTPmemberrm_pkt4 Oct '05 - 3:08 
Hi
Very nice article.
I have a query.?
How can I implemment Security over FTP..?
(Both in Server and Client)
My sicere thanks in advance.

 
Best Regards
Kumar
QuestionAPPEND feature for FTP?memberLowell20 Sep '05 - 9:35 
I was looking thru the code on this project, because I was specifically looking for an implementation of the APPEND FTP command; in my case, i want to append information via FTP, rhatehr than replace an exisitng file witht eh same name.
Any plans on implementing this command?
AnswerRe: APPEND feature for FTP?memberPablo van der Meer20 Sep '05 - 9:38 
It has already been implemented in newer releases:
http://www.pablosoftwaresolutions.com/html/ftp_wanderer.html
GeneralRe: APPEND feature for FTP?memberLowell21 Sep '05 - 8:37 
I looked on your site, and did not actually see an APPEND feature; is this the same as your "resume feature for upload and download" mentioned there?
I've already written a class wrapped around the inet control in VB,but i never found out how to append to an existing file using the inet control...the RETR command, to resume a previously started download, is supported by some FTP servers, but the inet control doesn't seem to have an append command like the ftp.exe / command prompt program does to APPEND more data to an Existing File on the FTP Site
 
-- modified at 14:41 Wednesday 21st September, 2005
GeneralRe: APPEND feature for FTP?memberPablo van der Meer21 Sep '05 - 9:27 
You can use the WININET FTPCommand API to send custom commands to an FTP server. You'll have to parse the response yourself.
GeneralThere are two bugs with your Ftp Wanderermembersiduizhangjian@hotmail.com26 May '05 - 14:52 
1.when i download(or upload) a file with its size larger than 40M ,i find the process bar display wrong, and i find the bug is that : " the value you define the progress bar, when in multiply * 100, it will outband ,so you should define it with 'double'" ,
2.when it in multiThread download ,it work does not smoothly, and when it work in singleThread download ,it work well
 
siduizhangjian
GeneralRe: There are two bugs with your Ftp WanderermemberPablo van der Meer26 May '05 - 19:44 
These bugs and hundreds of others have been fixed in the latest release.
Please download the latest version from my website:
http://www.pablosoftwaresolutions.com/html/ftp_wanderer.html
 

GeneralRe: There are two bugs with your Ftp WanderermemberTuPacMansur8 Jan '06 - 8:54 
Well the site you always mention do not give the source code. Please don't do commercial solicitation in here.
 
Umer Mansoor
GeneralResourcesmemberbluecoolz23 Nov '04 - 20:23 
Background information: Video-on-demand FTP
 
Hi, I am looking for the project workspace for FTP wanderer... and it is a very good project... I am currently using it as a reference for my school project... However, I need to make amendments to the disalog box, as I want to add an additional button... This button is for me to play the video file on transfer...
 
My questions are, how much I could not access and look at the resources for the FTP wanderer...? And with your knowledge, during file transfers, can I play the videos...?
 

 

Generalproxymembersway19 Nov '04 - 20:38 
How to use socks proxy to connect to remote server?
GeneralRe: proxysussAnonymous19 Nov '04 - 20:52 
I've added proxy support to newer versions (1.5 and higher) of the software:
http://www.pablovandermeer.nl/ftp_wanderer.html
Premium members of my website can download the source that include proxy support.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 31 Jul 2002
Article Copyright 2002 by Pablo van der Meer
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid