5

I really wonder how torrent downloads can be resumed at later point of time. If such a technology exists, then why is it not possible in browsers?

It is often not possible to pause a browser download so that it can be resumed at a later point of time. Often, the download will start again from the beginning. But in the case of a torrent download, you can resume anytime.

One reason I could think of is that a browser makes an HTTP connection to the server which contains the file, and when this connection breaks, there is no data regarding how much file was saved so no resume is possible.

Is there a fundamental reason why torrent downloads are easier to resume than web downloads?

Raphael
  • 73,212
  • 30
  • 182
  • 400
Sachin Jain
  • 161
  • 4

3 Answers3

8

The bittorrent protocol was designed to transfer large files out-of-order. It divides files in chunks (pieces in bittorrent terminology), and maintains a map of which participant holds which chunks. One of the elementary commands is for one participant to request a chunk from another participant. If a client crashes or disconnects, it can check which chunks it has already downloaded (the base data includes a cryptographic checksum for each chunk) and request only chunks that it does not already have. I think bittorrent includes a command to request part of a chunk, too, but if worst comes to worst only chunks that have not been fully downloaded need to be re-requested.

The HTTP protocol was designed to transfer mainly small files and to be simple to implement. Its most basic command is to download one file with a minimum of fuss. A simple server may only understand one command, to download a file in full. Hence, if the download is interrupted, there is no choice but to download the whole file again. There is a way for a client to request only part of a file (with the Range: header). Not all servers implement it (because it is not a fundamental feature of HTTP). Web browsers typically don't bother with it (because they are primarily designed to download small files: web pages), but all download managers support it (because they are designed to load large files) and will use it if the server accepts.

Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184
3

Actually, most browsers can resume downloads, provided they are from an FTP-server.

The difference between HTTP and FTP downloads is that whereas FTP has the REST(art) command to start a file transfer from a specified point, the HTTP protocol knows no such method. With HTTP, you always get the whole file, starting from the first byte.

As for the BitTorrent protocol, the file or files are split into chunks and individual chunks are fetched from different machines. The BitTorrent client keeps track of which chunks have been received and which are missing, and on restart only requests the missing chunks from other clients.

Update

As svick pointed out in the comments, HTTP does support sending only parts of a file, but as Raphael, this is somewhat an abuse of the original protocol.

Pedro
  • 1,116
  • 5
  • 14
2

It depends of the server. If the server accepts the resume or continue operation then you can resume the download if you have the appropriate software, e.g. wget that does that since the beginning, even for HTTP.

Some download manager that you can integrate in your browser does that, but for some reason browsers usually don't do that by default.

BitTorrent manages this very easily since it only downloads files pieces by pieces.

jmad
  • 9,578
  • 1
  • 40
  • 43