FTP下载的进度?

mtj520 2011-09-19 03:14:42
我写了一个FTP下载的程序,直接调用ftpgetFile函数下载。但是这个函数我取不到下载的进度。
原先的逻辑是,想用getfilesize不断的去取当前下载的这个文件的大小。但是这种方法不行,文件在下载的过程中我用这个函数取不到大小,后面看了下网站上的知识,说可以用这个回调函数InternetSetStatusCallback 可以取到下载的信息与大小,之前没用过,请前辈赐教。我知道怎么设置回调,但是就在我自己写的回调函数中,怎么去实现实时的监控下载文件的大小!
...全文
299 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
shangwu_35 2012-01-21
  • 打赏
  • 举报
回复
先获得下载文件的大小,你接收数据的粒度,大小/粒度
chan70707 2011-12-05
  • 打赏
  • 举报
回复
最近也要写FTP,不知楼主解决没有,帮顶下
绿领巾童鞋 2011-11-04
  • 打赏
  • 举报
回复
楼上的,有没有比较好的C++MFC方面的教材
wyx100 2011-11-04
  • 打赏
  • 举报
回复
查一下ftp的相关资料,或者协议
mtj520 2011-11-04
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jennyvenus 的回复:]
http://topic.csdn.net/t/20061222/18/5250179.html
[/Quote]
这个完全没懂。。。
用户 昵称 2011-10-19
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20061222/18/5250179.html
mtj520 2011-10-18
  • 打赏
  • 举报
回复
上面的完全看不明白。有没有这方面的例子啊!
oyljerry 2011-09-19
  • 打赏
  • 举报
回复
BOOL FtpGetFile(
IN HINTERNET hFtpSession,
IN LPCTSTR lpszRemoteFile,
IN LPCTSTR lpszNewFile,
IN BOOL fFailIfExists,
IN DWORD dwFlagsAndAttributes,
IN DWORD dwFlags,
IN DWORD dwContext
);

Retrieves a file from the FTP server and stores it under the specified file name, creating a new local file in the process.

Returns TRUE if successful, or FALSE otherwise. To get a specific error code, call GetLastError.
hFtpSession
Valid handle to an FTP session.
lpszRemoteFile
Address of a null-terminated string that contains the name of the file to retrieve from the remote system.
lpszNewFile
Address of a null-terminated string that contains the name of the file to create on the local system.
fFailIfExists
Boolean flag that indicates whether the function should proceed if a local file of the specified name already exists. If fFailIfExists is TRUE and the local file exists, FtpGetFile fails.
dwFlagsAndAttributes
File attributes and flags for the new file. Can be any combination of FILE_ATTRIBUTE_* and INTERNET_FLAG_* file attributes. See CreateFile for more information on FILE_ATTRIBUTE_* attributes, and see InternetOpenUrl for more information on INTERNET_FLAG_* flags.
dwFlags
Flag value that indicates the conditions under which the transfer occurs. Can be any of the FTP_TRANSFER_TYPE_* values. For a description of these values, see FtpOpenFile.
dwContext
Application-defined value that associates this search with any application data. This is used only if the application has already called InternetSetStatusCallback to set up a status callback function.
jsyren 2011-09-19
  • 打赏
  • 举报
回复
建议你仔细查一下ftp的相关资料,或者协议。。。。。。。。。
进度这个问题肯定是可以解决的。。。
我研究过ftp,不过现在不想去查了,你自己去查吧。。。。。。

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧