MFC

A typical FTP client application creates a CInternetSession and a CFtpConnection object. Note that these MFC WinInet classes do not actually control the proxy type settings; IIS does.

Also, see these Knowledge Base articles:

HOWTO: FTP with CERN-Based Proxy Using WinInet API (Article ID: Q166961)

SAMPLE: FTP with CERN-Based Password Protected Proxy (Article ID: Q216214)

Internet Services Manager Fails to Show Installed Proxy Services (Article ID: Q216802)

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 CInternetSession object.
Initializes WinInet and connects to server.

Connect to an FTP server.
Use CInternetSession::GetFtpConnection.
Returns a CFtpConnection object.

Change to a new FTP directory on the server.
Use CFtpConnection::SetCurrentDirectory.
Changes the directory you are currently connected to on the server.

Find the first file in the FTP directory.
Use CFtpFileFind::FindFile.
Finds the first file. Returns FALSE if no files are found.

Find the next file in the FTP directory.
Use CFtpFileFind::FindNextFile.
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 CFtpConnection::OpenFile, using the file name returned by FindFile or FindNextFile.
Opens the file on the server for reading or writing. Returns a CInternetFile object.

Read from or write to the file.
Use CInternetFile::Read or CInternetFile::Write.
Reads or writes the specified number of bytes, using a buffer you supply.

Handle exceptions.
Use the CInternetException class.
Handles all common Internet exception types.

End the FTP session.
Dispose of the CInternetSession object.
Automatically cleans up open file handles and connections.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值