What is bittorrent protocol and how does bittorrent protocol work
People who are addicted to using internet are aware of the term Bittorrent protocol. No file sharing websites offer the gigantic quantity of data sharing on the internet as bittorrent offers. Reports claim that bittorrent protocol alone uses almost 50 percent of the internet traffic. Its also a threat to copyrighted content on the internet.
In this post we will walk through all aspects of the protocol, like the following.
- What infact is bittorrent protocol?
- Who provides and supports bittorrent protocol.?
- What are the legal complexities involved in bittorrent protocol?
- How is bittorrent protocol different from other protocols on the internet?
Programmer Bram Cohen wrote the protocol in 2001. Although python was the language he used first for making the bittorrent client, clients were also made in other languages later on.Almost all the computing platforms support bittorrent protocol through large number of clients available ready to install.As per Bittorrent Inc, the protocol is used by more than a jaw dropping 100 million active users. Lets first understand how a normal downloading of a file from internet works, and then we will understand how downloading in bittorrent protocol happens.
How is a normal file from internet downloaded?
Normally whenever a file is downloaded from the internet through any website, it either uses HTTP protocol or sometimes FTP protocol if that website supports FTP publicly.
In any case there are two entities involved in the process. Those entities are
- client (one who downloads the file)
- Server (one who provides the file to download)
The red machine shown above is a server, and all other green are clients. As you can clearly see all these clients starts downloading the file from that single server.
If the popularity of the file is much more, then more clients will be downloading the file from the server. Which will result in the following things.
- The bandwidth available to the server is limited, so as the number of clients increase the speed available to each client will decrease.
- Due to large amounts of clients requesting files, the web server processor will be under load, and due to which the clients will experience a lag in response.
How does normal Peer to Peer file sharing works?
Now the term peer to peer does convey something.
It conveys that everything is between one peer and the other peer. So in this case unlike the previous server to client downloads, there is no central server from where the clients are downloading files.
In fact all the people participating in the download are servers and also clients together.
Which means if computer A has the file that computer B requires, then client computer B starts downloading it from computer A. At the same time if computer C requires a file that's available with computer B, then computer C starts downloading it from computer B. So computer B is downloading so its a client, and is also giving a file to computer C so its a server also. Each and everybody(or call every peer) participating in the download acts as the both the server and the client together.
this kind of peer to peer file sharing works with the help of a software that must be installed on every computer that's taking part in the file sharing.This software on startup will search other computers connected online, with the same software for the file you want.The main plus point is that there is no Main central server required for this kind of download. So there is no load or bandwidth limit on a single machine.Napster was a well known file sharing service through peer to peer networking model. Napster was concentrated on sharing music files on the internet, which led to copyright issues and later on merged with Rhapsody.
How does Bittorrent Protocol Work?
Bit torrent protocol is also somewhat similar to the above mentioned peer to peer file sharing where the file is not downloaded from a single server. All the peers participating in the download are servers and clients together. So what is different in torrent?In peer to peer file sharing the computers containing the file that you want to download are searched and reported by the software that you use, for peer to peer sharing.For example Gnutella. But in case of torrents. There is an entity called as "TRACKER".
Tracker in bittorret:
Tracker is the one central server machine that keeps track of the clients downloading a particular file. For example tracker knows the exact address of the computers that completed downloading a particular file, or computers that are in the process of downloading a file.
Whenever you start downloading a particular file using torrent the first thing that the torrent client software does is to query the tracker for the list of other peers, who have the file ready for download.Without the presence of the tracker, peers will be unable to start a download. In between the downloading session the peers send information back and forth to tracker, regarding the status. The tracker keeps on informing all the peers about other peers during the complete session of the download.So in short you can say that tracker is an important part in the torrent protocol.
What is .torrent file?
A torrent file associated with the file you want to download is very much necessary for downloading torrents. Without the torrent file nothing can be done. Torrent file does not contain any information about the original data that you want to download.
But torrent file does contain information about the tracker, and other metadata about the original data that you want to download.
Whenever you want to share a some data with you, using torrent, the first thing to do is to create a .torrent file for that data. The data is divided into small chunks of equal size. Only one chunk is downloaded at a time. And each and every chunk have a cryptographic hash. So whenever a chunk is received it can compared the cryptographic hash of that chunk with the hash provided by the .torrent file and detect if the data is original.
So the steps involved in sharing data through torrent is as follows.
Step 1:The user creates a .torrent file related to his data(with the help of torrent client software), that he wants to share. the client software will include tracker address provided by the user at the creation in the .torrent file. And the cryptographic hashes of all the pieces(small chunks) of the data.
Step 2:the user shares the .torrent file to the public using methods like email, messenger etc. Or an indexer website which stores many .torrent files with the description of the data.
Step 3:a user who wants the data downloads the .torrent file and opens that .torrent file using the torrent client application. The client will query the tracker server, which he got from the .torrent file for the download location(the clients who are downloading the file or completed downloading the file). One chunk is downloaded at a time from others at a time. When all the chunks are downloaded, then this user will become a torrent seed for that data.
On completion of download of each chunk the client informs the tracker, so that other people who want that chunk can download it.
It does not matter if a client gets all the different chunks from different people. In the end the chunks are combined together by the torrent client software and the original data is formed. Each and every chunk on receiving is compared with the hash of that chunk available in the .torrent file, which helps in keeping the integrity check of the whole file accurate.
What are seeds in bittorrent?
Seeders are the computers with the bittorrent client software installed and have completed downloading a particular data(with all the chunks), and acts as a server for other clients to download the data. basically seeders have completed downloading but still their clients are active in uploading data for other clients.
What are leechers in bitorrent?
Leachers are the computer clients who does not have the file, but are downloading the chunks from different clients. the chunks available with a leeche can be downloaded by other clients.
What is torrent health?
An overall health of a torrent data is the ratio between the total number of seeders and leechers. A torrent data having more number of seeders are considered to have a good health.
How can i create a torrent file for my data i want to share?
If you want to share a data through torrent then you can easily do that with the help of you torrent client. I will explain the method to create it with utorrent client software.First you need to open utorrent software which is used for downloading torrent data.
and select the option "create new torrent" from the "file" menu as shown below.
this will open a window as shown below.
As you can see from the above figure there are options to add a file or a directory. There are tracker addresses which are by default available in utorrent.
An important option to note here is the piece size(this is the chunk size in which the data will be divided).
Select the file/folder that you want to share and add comments if you want and press on the "create and save as" button Which will create the .torrent.
Also click on "start seeding" for starting the initial upload of the data to other clients from your computer.
How to share file with friends using torrent without a public tracker?
Now in the previous example while creating a torrent file we have used the default public trackers that were available and selected by utorrent software itself.
Now if you want yourself to become a tracker and share the data with your friends(which is too private), then you can do that by the below method.
Go to options > preferences > connections in utorrentThere you will be able to see your port number used for incoming connections. Note that port number.
Now again go back to "create new torrent" option as explained previously and in the window select "private torrent".In place of trackers add the below tracker(after removing other trackers available)http:// YOUR IP ADDRESS:PORT NUMBER/announce.
For example if my ip address is 192.168.0.1 and my port number i got is 5764 then the tracker url will be as below. http://192.168.0.1:5764/announce.
Note: the ip i used is a private range ip for example.In real world you need to use public IP.
What are the legal complications of bittorrent protocol?
The bittorrent protocol is legal, but if the content shared through this protocol is copyrighted then in that case it becomes illegal.
The person taking part in downloading or uploading a copyrighted material through bittorrent can be booked under various copyright infringement laws.
In some countries hosting bittorrent files are legal, so downloading files from there to different geographical locations where it is considered illegal becomes a complicated matter.
Several bittorrent indexing and trackers were closed and shut down by law enforcement agencies.
I hope this post was useful in understanding the protocol. And please use this nice protocol only to download legal contents. I will soon be posting on DHT and Magnetic Links adopted by many torrent sites these days.