## Metakit sample code - FtpCat

This tiny application does not illustrate any new aspects fo Metakit, but it may be useful in its own right, especially with the CatFish application described hereafter.

What it does: FtpCat creates a catalog file of a directory tree, just like DisCat. In this case, however the directory listings are obtained from an FTP server anywhere on the network. Since FtpCat has no browse facility, you will have to use CatSend & CatrRecv (or Dump) to examine the contents of the resulting catalog.

What it illustrates: FtpCat is a 32-bit console application, which is dynamically linked to both Metakit and MFC. FtpCat is a bit peculiar, in that it uses the FTP.EXE application which is part of Windows 95 to take care of all networking (after all, Metakit is not an introduction on how to build ftp clients). There are no ftp-related routines, nor even any Winsock calls, in FtpCat. There is a fair amount of tricky code in here to juggle two pipes which are used to control the child process (ftp.exe).

How to use it: FtpCat is very simple to use: simply call it with an URL as argument, and it will open an ftp connection and retrieve the listings of the specified directory and all its subdirectories. If you do not supply a second parameter, the catalog will be stored in a file called "ftpcat.dat". As with DisCat, you can then use CatSend & CatRecv to examine the catalog contents.

If you're connected to Internet, you could try "ftpcat ftp://ftp.winsite.com/pub/pc/win3/programr" (this is one the areas where new distributions of the Metakit library are posted). The "ftp://" prefix is optional, and you may add a "user:password@" prefix to the site to login under a specific name. This allows you to produce a catalog of protected areas, for example with "ftpcat user:passwd@mysite.org/mydir". Please be aware of the fact that some sites on internet are huge, and that a command such as "ftpcat ftp.winsite.com" which uses "/" as default path may take some time to complete, depending on the speed of your connection.

Known problems: None, but there are some limitations in this sample application:

1. The "site:port" notation is not implemented, you can only connect to standard ftp servers.
2. This version does not commit intermediate results to file. If you cancel it, nothing is saved.

Files in EXAMPLES\FTPCAT:

FTPCAT.CPP - FtpCat main program
FTPCAT.MAK, FTPCAT.MDP - MSVC 4.2 project makefiles for Win32

|| Roadmap Class Index Sample Index || Introduction Tips and Tricks ||