https://github.com/KaiserCoaster/BitTorrent

Overview

This BitTorrent Client was developed for a group project in Internet Technology (CS 352). We were tasked with building the client almost completely from scratch, including GET requests to the tracker and transmitting data over sockets to multiple peers. Additional features include: ability to pause and resume downloads, sending downloaded pieces to other peers, actively accepting and setting up new connections.

Technical Information

The project was programmed in Java. We used threads and locks to have multiple concurrent peer connections. Each peer had a queue to act as a buffer for incoming and outgoing messages.

One of the biggest challenges we faced was actually caused by other students. According to the BitTorrent protocol, peers choose a 20-byte  peer ID and sent that to the tracker. Even though the ID could be binary data, the decoder we were provided with did not work properly when provided with non ASCII characters. Whether on purpose or by accident, students provided the tracker with non-ASCII bytes, causing the tracker to repeat those IDs to everyone else using the tracker, ultimately throwing an exception from the decoder we were provided with. To overcome this issue, we considered how much time we were willing to spend. We decided that changes to the decoder would be too drastic, so we opted to replace non-ASCII bytes in the tracker response with valid characters before passing it to the decoder. As a downside, we are not able to connect to these modified peer IDs since the handshake to establish the connection would fail when verifying the IDs.

← Return to Projects