c++线程断点续传实现欢迎砸砖

vpchangxin 2014-03-27 07:41:50
如题
c++单线程断点续传实现欢迎砸砖
博客详细教程链接http://blog.csdn.net/vpingchangxin/article/details/22309067

免费提供 下载链接 http://download.csdn.net/detail/vpingchangxin/7108649
...全文
308 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
mujiok2003 2014-04-14
  • 打赏
  • 举报
回复
引用 11 楼 vpingchangxin 的回复:
[quote=引用 9 楼 mujiok2003 的回复:] [quote=引用 8 楼 vpingchangxin 的回复:] 直接在网站上找个 可以下载文件的链接贴进去就ok了 好像好多Http服务器下载文件的都支持断点下载文件读取 如果服务器不支持断点读文件应对服务器稍作配置一下
服务器不可能都让你修改的。 [/quote] http://curl.haxx.se/libcurl/c/curl_easy_setopt.html 打开上面链接ctrl+F 搜 CURLOPT_RESUME_FROM 看吧
Pass a long as parameter. It contains the offset in number of bytes that you want the transfer to start from. Set this option to 0 to make the transfer start from the beginning (effectively disabling resume). For FTP, set this option to -1 to make the transfer start from the end of the target file (useful to continue an interrupted upload).

When doing uploads with FTP, the resume position is where in the local/source file libcurl should try to resume the upload from and it will then append the source file to the remote target file.
中的Pass a long as parameter. It contains the offset in number of bytes that you want the transfer to start from 说 设置一个long参数,它包含的偏移数就是你希望要传输的开始位置

/* Set the continuation offset.
   *
   * Note there is also a _LARGE version of this key which uses
   * off_t types, allowing for large file offsets on platforms which
   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
   */
  CINIT(RESUME_FROM, LONG, 21),
这个是 curl.h 中的注释更说明了 大文件偏移设置 请楼上滴看清楚curl的api后质疑[/quote] 不是所有无服务器都是遵守相同的协议的, 这是我的意思。curl就是一个library而已。
vpchangxin 2014-04-14
  • 打赏
  • 举报
回复
引用 9 楼 mujiok2003 的回复:
[quote=引用 8 楼 vpingchangxin 的回复:] 直接在网站上找个 可以下载文件的链接贴进去就ok了 好像好多Http服务器下载文件的都支持断点下载文件读取 如果服务器不支持断点读文件应对服务器稍作配置一下
服务器不可能都让你修改的。 [/quote] http://curl.haxx.se/libcurl/c/curl_easy_setopt.html 打开上面链接ctrl+F 搜 CURLOPT_RESUME_FROM 看吧
Pass a long as parameter. It contains the offset in number of bytes that you want the transfer to start from. Set this option to 0 to make the transfer start from the beginning (effectively disabling resume). For FTP, set this option to -1 to make the transfer start from the end of the target file (useful to continue an interrupted upload).

When doing uploads with FTP, the resume position is where in the local/source file libcurl should try to resume the upload from and it will then append the source file to the remote target file.
中的Pass a long as parameter. It contains the offset in number of bytes that you want the transfer to start from 说 设置一个long参数,它包含的偏移数就是你希望要传输的开始位置

/* Set the continuation offset.
   *
   * Note there is also a _LARGE version of this key which uses
   * off_t types, allowing for large file offsets on platforms which
   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
   */
  CINIT(RESUME_FROM, LONG, 21),
这个是 curl.h 中的注释更说明了 大文件偏移设置 请楼上滴看清楚curl的api后质疑
tbwork 2014-04-11
  • 打赏
  • 举报
回复
引用 楼主 vpingchangxin 的回复:
如题 c++单线程断点续传实现欢迎砸砖 博客详细教程链接http://blog.csdn.net/vpingchangxin/article/details/22309067 免费提供 下载链接 http://download.csdn.net/detail/vpingchangxin/7108649
mujiok2003 2014-04-11
  • 打赏
  • 举报
回复
引用 8 楼 vpingchangxin 的回复:
直接在网站上找个 可以下载文件的链接贴进去就ok了 好像好多Http服务器下载文件的都支持断点下载文件读取 如果服务器不支持断点读文件应对服务器稍作配置一下
服务器不可能都让你修改的。
vpchangxin 2014-04-11
  • 打赏
  • 举报
回复
引用 7 楼 ADF1230 的回复:
这个断点续传是client端的吧? curl_easy_setopt(handle, CURLOPT_RESUME_FROM, localFileLenth); // 从本地大小位置进行请求数据 这一句应该需要server端的配合吧 ? server端用什么的啊?
直接在网站上找个 可以下载文件的链接贴进去就ok了 好像好多Http服务器下载文件的都支持断点下载文件读取 如果服务器不支持断点读文件应对服务器稍作配置一下
神-气 2014-04-10
  • 打赏
  • 举报
回复
这个断点续传是client端的吧? curl_easy_setopt(handle, CURLOPT_RESUME_FROM, localFileLenth); // 从本地大小位置进行请求数据 这一句应该需要server端的配合吧 ? server端用什么的啊?
vpchangxin 2014-04-10
  • 打赏
  • 举报
回复
悲剧哟 !! 没多少人
yy21yeyu 2014-03-28
  • 打赏
  • 举报
回复
解了我燃眉之急啊。。虽然我自己也不知道好使不。。。顺便求分
vpchangxin 2014-03-28
  • 打赏
  • 举报
回复
没人顶呀!!
百曉生 2014-03-28
  • 打赏
  • 举报
回复
占个位置,有需要了就看看
赵4老师 2014-03-28
  • 打赏
  • 举报
回复
我是人。 下载研究eMule源代码。
没事人 2014-03-27
  • 打赏
  • 举报
回复
下了有空研究研究

65,208

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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