3

I would like to implement pause & resume functionality for downloading a file both for Server & Client. My Questions are:

What Protocol do I need to implement at server site (It will be .NET) ? Is there any example, tutorial, library anything that can be helpful to implement this functionality at the client site (It will be in C++) ?

Thanks, Yuvi

Yuvi
  • 1,344
  • 4
  • 24
  • 46
  • Why would the server care? Just stop reading the socket in the client code. – Hans Passant Feb 16 '12 at 05:13
  • If server is not able to provide resume functionality.. Then client have to start downloading again from beginning.. – Yuvi Feb 16 '12 at 05:15
  • As long as the protocol provides seek / range functionality, all the client needs to do at resume is seek to the right spot in the file. HTTP 1.1 has this functionality, and I believe it can be done in FTP as well. – tripleee Feb 16 '12 at 06:05

1 Answers1

0

I created a simple download manager using Qt C++, here is code. Idea is to set "range" http header at client side.

In server side, you need to seek file at particular position as specified in "range" header.

Kunal
  • 3,475
  • 21
  • 14
  • QT has very good Networking Classes, but for only C++ I haven't found any reference link :( – Yuvi Feb 16 '12 at 05:44
  • how about libcurl (http://curl.haxx.se/libcurl/competitors.html), i have not used it my self but looks promosing. – Kunal Feb 16 '12 at 06:09
  • yes I am going through libcurl and Boost::asio, but not able to find any refernce doc that has functions for http range request. – Yuvi Feb 16 '12 at 06:18
  • I guess you can use following code to set header in libcurl, struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); There are some example here ->http://curl.haxx.se/libcurl/c/example.html – Kunal Feb 16 '12 at 06:31