TRENDING

BitTorrent Protocol: What It Is and How It Works

BitTorrent protocol it’s still one of the best alternatives for optimizing large file transfers.

Bittorrent Explainer
No comments Twitter Flipboard E-mail

Although the BitTorrent protocol has lost some popularity compared to other download methods, like direct downloading, it’s still one of the best alternatives for optimizing large file transfers over the Internet. Here's a breakdown of how it works.

When you download a file from a website, it comes to your computer as a data stream. But what happens if several people want to download the same file simultaneously? You'd have a single server sending the file to several different destinations. Since the server has an upload speed limit, the download speed will eventually slow down as many people try to download the file. How do you solve this problem? That's what BitTorrent does.

BitTorrent is a protocol, a set of rules which establishes a file-sharing reference according to the peer-to-peer (P2P) philosophy. With BitTorrent, every destination computer also becomes a source. In this way, users download the file from the original source and share the downloaded parts with each other. This is the key to the BitTorrent protocol and P2P technology.

The Tracker

So far, so good, but who is organizing this network of peers (also known as a swarm)? How does each user know which other users to connect to in order to download a file? Here’s where a particular server called "tracker" comes in.

A tracker is essentially the organizer of the entire distribution system. It contains all the necessary information for peers to connect to each other using the BitTorrent protocol.  Therefore, trackers are the only meeting point that users must connect to in order to download a file.

When a client downloads a file, it asks the tracker for more information. The tracker provides an initial list of peers randomly selected from all the users downloading the file. This list will increase as new clients arrive and decrease as they disconnect.

Each client contacts the tracker from time to time, or when disconnected, to update its status, indicating the number of bytes it's downloaded and uploaded to the swarm. When a downloading peer—also known as a leecher—completes the file, it becomes a seed. Generally, the more seeds and leechers in the swarm, the higher the transfer speeds.

How It All Begins

We’ve already covered the basics, but how does the process begin? First, it’s necessary to split the file’s contents into small fragments known as pieces—usually between 64 KB and 4 MB. The program gives each fragment a hash or identifier. Finally, it creates a file with the extension *.torrent, which specifies the location of the tracker and the information about the fragments we were talking about. Although it may seem tedious, this process is simplified using clients since the software takes care of everything. Here’s an example of a *.torrent file:

{

‘announce’: ‘http://bttracker.debian.org:6969/announce’,

‘info’:

{

‘length’: 678301696,

‘name’: ‘debian-503-amd64-CD-1.iso’,

‘pieces length’: 262144,

‘pieces’: <binary SHA1 hashes>.

}

}

Next, the program uploads this *.torrent file to a web server, making it available to anyone who wants to download it. Transferring the original file would be as simple as downloading the associated *.torrent file and opening it with a program or client designed for that purpose.

BitTorrent Clients

Now, you have the *.torrent file associated with the file you want to download to your computer. What do you do with it? You need to open it with a client supporting this type of file. There are many, such as multiple simultaneous download clients like BitComet and the classic μTorrent.

Advantages

  • Servers aren’t saturated: Original content providers save bandwidth by not having to serve a particular file to all the customers who want it. The protocol uses the bandwidth of the users who download the file.
  • Redundancy: With the original classic file distribution model, it’s impossible to access the content if the server is unavailable for whatever reason. With BitTorrent, this is possible if at least one peer has received the complete file.
  • High availability of downloads: Many users are connected, so fragments can be downloaded from multiple users at the same time.

Disadvantages

  • Errors and traps: Despite the high reliability, sometimes there are minor errors in compiling the complete file. Some companies even introduce fake files to sabotage the transfers.
  • Peer dependency: If the users who receive the file disconnect as soon as they download it or have limited the speed at which they share the file, the BitTorrent protocol loses all meaning.
  • Tracker dependency: The tracker is the organizer. Without it, transfers wouldn’t be possible. However, some clients have alternative distributed tracker implementations, so preventing a transfer would be as simple as taking the tracker “out of the game.”

Despite these drawbacks, it’s clear that BitTorrent is an ideal protocol for transferring files and large blocks of information. Although it’s often associated with downloading audiovisual content, its use isn’t limited to these files. Many individuals and organizations use BitTorrent to distribute their own or licensed works.

This article was written by María González and originally published in Spanish.

Images | BitTorrent | Xataka On

Related | How to See Old Versions of a Website: View Google’s Cached Pages or Visit Archive.org

Home o Index