September 23, 2014

HTG Explains: How Does BitTorrent Work?

bittorrent-swarm


BitTorrent consumes 12% of total Internet traffic in North America and 36% of total traffic in the Asia-Pacific region, according to a 2012 study. It’s so popular that the new “Copyright Alert System” targets BitTorrent traffic alone.
BitTorrent may be popularly known as a method of piracy, but it isn’t just for pirates. It’s a useful, decentralized peer-to-peer protocol with significant advantages over other protocols in many situations.
This article will help you understand how the BitTorrent protocol works and why it’s not just a tool for piracy. We’ve previously explained how to get started with BitTorrent.

How BitTorrent Works

When you download a web page like this one, your computer connects to the web server and downloads the data directly from that server. Each computer that downloads the data downloads it from the web page’s central server. This is how much of the traffic on the web works.


network-with-central-server


BitTorrent is a peer-to-peer protocol, which means that the computers in a BitTorrent “swarm” (a group of computers downloading and uploading the same torrent) transfer data between each other without the need for a central server.


peer-to-peer-network


Traditionally, a computer joins a BitTorrent swarm by loading a .torrent file into a BitTorrent client. The BitTorrent client contacts a “tracker” specified in the .torrent file. The tracker is a special server that keeps track of the connected computers. The tracker shares their IP addresses with other BitTorrent clients in the swarm, allowing them to connect to each other.
Once connected, a BitTorrent client downloads bits of the files in the torrent in small pieces, downloading all the data it can get. Once the BitTorrent client has some data, it can then begin to upload that data to other BitTorrent clients in the swarm. In this way, everyone downloading a torrent is also uploading the same torrent. This speeds up everyone’s download speed. If 10,000 people are downloading the same file, it doesn’t put a lot of stress on a central server. Instead, each downloader contributes upload bandwidth to other downloaders, ensuring the torrent stays fast.
Importantly, BitTorrent clients never actually download files from the tracker itself. The tracker participates in the torrent only by keeping track of the BitTorrent clients connected to the swarm, not actually by downloading or uploading data.

Leechers and Seeders

Users downloading from a BitTorrent swarm are commonly referred to as “leechers” or “peers”. Users that remain connected to a BitTorrent swarm even after they’ve downloaded the complete file, contributing more of their upload bandwidth so other people can continue to download the file, are referred to as “seeders”. For a torrent to be downloadable, one seeder – who has a complete copy of all the files in the torrent – must initially join the swarm so other users can download the data. If a torrent has no seeders, it won’t be possible to download – no connected user has the complete file.
BitTorrent clients reward other clients who upload, preferring to send data to clients who contribute more upload bandwidth rather than sending data to clients who upload at a very slow speed. This speeds up download times for the swarm as a whole and rewards users who contribute more upload bandwidth.


utorrent-peers-and-seeds

Torrent Trackers and Trackerless Torrents

In recent times, a decentralized “trackerless” torrent system allows BitTorrent clients to communicate among each other without the need for any central servers. BitTorrent clients use distributed hash table (DHT) technology for this, with each BitTorrent client functioning as a DHT node. When you add a torrent using a “magnet link”, the DHT node contacts nearby nodes and those other nodes contact other nodes until they locate the information about the torrent.
As the DHT protocol specification says, “In effect, each peer becomes a tracker.” This means that BitTorrent clients no longer need a central server managing a swarm. Instead, BitTorrent becomes a fully decentralized peer-to-peer file transfer system.
DHT can also work alongside traditional trackers. For example, a torrent can use both DHT and a traditional tracker, which will provide redundancy in case the tracker fails.


dht-in-utorrent

BitTorrent Isn’t Just For Piracy

BitTorrent isn’t synonymous with piracy. Blizzard uses a custom BitTorrent client to distribute updates for its games, including World of Warcraft, StarCraft II, and Diablo 3. This helps speed up downloads for everyone by allowing people to share their upload bandwidth with others, leveraging unused bandwidth towards faster downloads for everyone. Of course, it also saves Blizzard money on their bandwidth bills.
People can use BitTorrent to distribute large files to significant numbers of people without paying for the web hosting bandwidth. A free film, music album, or game could be hosted on BitTorrent, allowing an easy, free method of distribution where the people downloading the file also help distribute it. WikiLeaks distributed data via BitTorrent, taking a significant load off their servers. Linux distributions use BitTorrent to help distribute their ISO disc images.
BitTorrent, Inc. – a company responsible for developing BitTorrent as a protocol, who also purchased and develop the popular µTorrent torrent client – is developing a variety of applications that use the BitTorrent protocol for new things via their BitTorrent Labs project. Labs experiments include a syncing application that securely synchronizes files between several computers by transferring the files directly via BitTorrent, and a BitTorrent Live experiment that uses the BitTorrent protocol to help broadcast live, streaming video, leveraging the power of BitTorrent to stream live video to large numbers of people without the current bandwidth requirements.


starcraft-2-peer-to-peer-download-feature



BitTorrent may be primarily used for piracy at the moment, as its decentralized and peer-to-peer nature are a direct response to efforts to crack down on Napster and other peer-to-peer networks with central points of failure. However, BitTorrent is a tool with legitimate uses in the present –  and many other potential uses in the future.

Source: http://www.howtogeek.com/141257/htg-explains-how-does-bittorrent-work/