如何取消 CFtpConnection::PutFile?
使用 UDP 套接字的 ftp 服务器和客户端 (C windows)。
服务器使用 CFtpConnection::PutFile< 将文件放在客户端上/a>
一个大文件需要几分钟的时间,因此客户端需要能够取消 PutFile()。
如果 PutFile() 正忙于传输数据,如何检查取消 udp 消息?创建另一个线程......?
任何正确方向的建议都值得赞赏,谢谢。
ftp server and client (C windows) using a UDP socket.
The server puts files on the client using CFtpConnection::PutFile
A large file takes several minutes, so the client needs to be able to cancel PutFile().
How do I check for a cancel udp message if PutFile() is busy transferring data? Create another thread....?
Any advice in the right direction is appreciated, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您需要对传输过程进行某种程度的控制,因此您无法采用
PutFile
的高级方法,并且您必须扮演更直接的角色。使用
CFtpConnection::OpenFile
用于写入,这将为您提供一个CInternetFile*
。然后,您可以使用CInternetFile::Write
自己做;您还可以选择随时停止发送数据并关闭连接。WinInet 文档的此页提到了 MS 知识库中的 HOWTO 和示例,这可能有助于研究实现。
Since you need some level of control for the transfer process, you can't go with the high-level approach of
PutFile
and you 'll have to take a more direct role.Open the remote file with
CFtpConnection::OpenFile
for writing, which will give you aCInternetFile*
. You would then write data usingCInternetFile::Write
by yourself; this will also give you the option to stop sending data and close the connection at any time.This page of WinInet documentation mentions a HOWTO and a sample in the MS Knowledge Base, which might be good to look into for an implementation.