Steps in a Typical FTP Client Application

OverviewHow Do I

A sample FTP client application is available. is a dialog-based application that displays the contents of an FTP site in a tree control.

The following table shows the steps you might perform in a typical FTP client application.

Your goal Actions you take Effects
Begin an FTP session. Create a  object. Initializes WinInet and connects to server.
Connect to an FTP server. Use . Returns a object.
Change to a new FTP directory on the server. Use . Changes the directory you are currently connected to on the server.
Find the first file in the FTP directory. Use . Finds the first file. Returns FALSE if no files are found.
Find the next file in the FTP directory. Use . Finds the next file. Returns FALSE if the file is not found.
Open the file found by FindFile or FindNextFile for reading or writing. Use , using the file name returned by or . Opens the file on the server for reading or writing. Returns a object.
Read from or write to the file. Use or . Reads or writes the specified number of bytes, using a buffer you supply.
Handle exceptions. Use the class. Handles all common Internet exception types.
End the FTP session. Dispose of the object. Automatically cleans up open file handles and connections.

See Also   Prerequisites for Internet Client Classes