The following table shows the steps you might perform in a typical FTP client application. A----Your goal B----Actions you take C----Effects 1、 A----Begin an FTP session. B----Create a CInternetSession object. C----Initializes WinInet and connects to server. 2、 A----Connect to an FTP server. B----UseCInternetSession::GetFtpConnection. C----Returns aCFtpConnection object. 3 A----Change to a new FTP directory on the server. B----UseCFtpConnection::SetCurrentDirectory. C----Changes the directory you are currently connected to on the server. 4 A----Find the first file in the FTP directory. B----UseCFtpFileFind::FindFile. Finds the first file. C----Returns FALSE if no files are found. 5 A----Find the next file in the FTP directory. B----UseCFtpFileFind::FindNextFile. C----Finds the next file. Returns FALSE if the file is not found. 6 A----Open the file found by FindFile or FindNextFile for reading or writing. B----UseCFtpConnection::OpenFile, using the file name returned byFindFile orFindNextFile. C----Opens the file on the server for reading or writing. Returns aCInternetFile object. 7 A----Read from or write to the file. B----UseCInternetFile::Read orCInternetFile::Write. C----Reads or writes the specified number of bytes, using a buffer you supply. 8 A----Handle exceptions. B----Use theCInternetException class. C----Handles all common Internet exception types. 9 A----End the FTP session. B----Dispose of theCInternetSession object. C----Automatically cleans up open file handles and connections.
The following table shows the steps you might perform in a typical FTP client application.
A----Your goal
B----Actions you take
C----Effects
1、
A----Begin an FTP session.
B----Create a CInternetSession object.
C----Initializes WinInet and connects to server.
2、
A----Connect to an FTP server.
B----UseCInternetSession::GetFtpConnection.
C----Returns aCFtpConnection object.
3
A----Change to a new FTP directory on the server.
B----UseCFtpConnection::SetCurrentDirectory.
C----Changes the directory you are currently connected to on the server.
4
A----Find the first file in the FTP directory.
B----UseCFtpFileFind::FindFile. Finds the first file.
C----Returns FALSE if no files are found.
5
A----Find the next file in the FTP directory.
B----UseCFtpFileFind::FindNextFile.
C----Finds the next file. Returns FALSE if the file is not found.
6
A----Open the file found by FindFile or FindNextFile for reading or writing.
B----UseCFtpConnection::OpenFile, using the file name returned byFindFile orFindNextFile.
C----Opens the file on the server for reading or writing. Returns aCInternetFile object.
7
A----Read from or write to the file.
B----UseCInternetFile::Read orCInternetFile::Write.
C----Reads or writes the specified number of bytes, using a buffer you supply.
8
A----Handle exceptions.
B----Use theCInternetException class.
C----Handles all common Internet exception types.
9
A----End the FTP session.
B----Dispose of theCInternetSession object.
C----Automatically cleans up open file handles and connections.