How do torrents work? (overly simplified)

ag
3 min readOct 11, 2018

BitTorrent networking protocol is the most popular protocol used in modern P2P (peer-to-peer) file sharing. Unlike the traditional server to client file transfer methods, torrents work by gathering pieces of the file you want and downloading these pieces simultaneously from people who already have them downloaded. This means that the maximum speed obtained is based on the amount of people that have the file downloaded and not limited by a server as the traditional file transfer methods.

Technology’s Creation

Torrent networking debuted in 2001. A Python-language programmer, Bram Cohen, created the technology with the intent to share it with everyone. It became popular starting from 2005 and till now, many of us still use torrents. The popularity is still growing due to the whole idea of peer to peer transfers.

Traditional File Transfers

In a traditional file transfer, client’s represent our browser whether it’s Chrome, Firefox or others and the server is the machine that’s running the website that we are downloading the file from.

In such an architecture, the server has full control over the network bandwidth and which client to give all the network speed to and which to limit. Also in such an architecture, many users downloading files from the server can cause lower downloading speeds.

How Torrents work and how they’re different

It’s all about swarming and tracking, users download small pieces from different peers at once.

“Swarming” is splitting files into smaller pieces and sharing those pieces across a list of users.

“Tracking” are when some servers help the torrent keep track of which users are downloading the torrent.

The “*.torrent” file that you download from the internet contains information about the torrent trackers and how the torrent client should assemble the pieces that it’s downloading together.

The download speed is also controlled by the trackers, they monitor all the users downloading the torrent and reward the users who are sharing the file with others by increasing their allowed bandwidth, which means that if you try throttling down your upload speed, you’ll only end up with less download speed

As you add a torrent to your torrent client ( µTorrent, BitTorrent, …)
Your computer starts by connecting to the torrent’s tracker servers, the tracker servers respond with a list of the users downloading the torrent or seeding (file fully downloaded but the client is still sharing it with other users) it. Afterwards, the client asks each client for a different piece of the torrent and it downloads it, as you download other peers ask your torrent client for some pieces that you’ve downloaded, and your client responds back by uploading those pieces to that peer. This process goes on till all the pieces are downloaded and put together. Afterwards your torrent client marks the torrent as finished and you’re now seeding the file to other users.

Torrents are perfectly legal to use. However, it is illegal to download copyrighted materials in most countries.

--

--