In this programming assignment, you will implement a decentralized peer-to-peer network architec- ture (P2P), including the basic implementation of the BitTorrent protocol (BTP). General P2P architec- tures can be classified into centralized and decentralized, In P2P centralized architectures, new peers send a request to the Traker (normally done via HTTP) requesting a list containing all the IP addresses of the peers that are already connected to the P2P network sharing the same file. The tracker then, replies with a response containing such list. In P2P decentralized architecture, each peer is also a Traker, and it can share only limited resources because it only sees the partial network. On the other hand, P2P decen- tralized networks avoid single point of failure since they do not depend of centralized trackers. Examples of P2P applications that are/were implementing centralizing architectures are Nasper, the Berkeley Open Network Infrastructure (BOINC) and some versions of BitTorrent. Other versions of BitTorrent implement decentralized architectures as well. 1. General terminology in a P2P BitTorrent protocol (BTP):
In this programming assignment, you will implement a decentralized peer-to-peer network architec-
ture (P2P), including the basic implementation of the BitTorrent protocol (BTP). General P2P architec-
tures can be classified into centralized and decentralized, In P2P centralized architectures, new peers send
a request to the Traker (normally done via HTTP) requesting a list containing all the IP addresses of
the peers that are already connected to the P2P network sharing the same file. The tracker then, replies
with a response containing such list. In P2P decentralized architecture, each peer is also a Traker, and it
can share only limited resources because it only sees the partial network. On the other hand, P2P decen-
tralized networks avoid single point of failure since they do not depend of centralized trackers. Examples
of P2P applications that are/were implementing centralizing architectures are Nasper, the Berkeley Open
Network Infrastructure (BOINC) and some versions of BitTorrent. Other versions of BitTorrent implement
decentralized architectures as well.
1. General terminology in a P2P BitTorrent protocol (BTP):
(a) Peer
Peers are those who are uploading and downloading data at the same time from other peers.
Note that they do not posses the whole resource that is being shared, only some pieces of it.
Peers become seeders for a specific file when they downloaded all the pieces from that file.
(b) Swarm
A swarm is a network of peers, leeches and seeders sharing the same file. The more seeders
a swarm has, there will be faster downloads rates among peers. In other words, there will be
better chances of getting the file faster at high download speed.
(c) Traker
Trackers in a semi-decentralized network a tracker is a server which only function is to send the
ip addresses of all the peers in the swarm. In a decentralized network, all the peers are also
trackers.
(d) Metainfo File
The metainfo file is also called as a torrent file and has a .torrent extension. This file mainly
contains encoded information regarding the URL of the tracker, name of the file, and hashes of
the pieces of the file for verifying downloaded pieces of the file.
1(e) Torrent
A torrent file is a file that contains meta-info (not the actual data) of the file that is being shared
on the swarm by all peers connected to it. It normally has extension .torrent and contain useful
info about the trackers, and the pieces of the file being shared in the network such as length,
SHA1 hashes of all the pieces
(f) Piece
A file shared in P2P is divided in pieces by the seeder. All the pieces from a torrent have the
same size with the only exception of the last piece which may have the leftover bytes. The
length of a piece is normally 16KIB, however this is defined by the implementer. For example,
a piece could also have a length of 32KIB, Info about the file,the length of its pieces, and the
hashes of the pieces are found in the Metainfo file (the file with extension .torrent)
(g) Blocks
Pieces from a torrent may became huge in size, we need to divide them into blocks. Blocks are
the basic structure transmitted in the swarm byte by byte. For example if a piece size is 16KIB,
blocks in that piece will be 2KIB. So, the piece will be split into 8 blocks. The final piece of a
f
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)