Homework 4 - BitTorrent
In this assignment, we create our own BitTorrent client. The template already does much of the heavy lifting. However, the template is multi-threaded, and can only leech.
Your job is to:
- Modify the template to no longer use threads. Instead, use select() to listen for incoming packets on multiple sockets simultaneously. Handle broken connections and other peer behaviors to ensure a reliable download.
- Announce available pieces to peers and handle incoming piece requests to maximize performance.
- Request pieces in the ideal order to minimize download time.
You'll find the template
here. Details of the bittorrent protocol can be found here:
https://wiki.theory.org/BitTorrentSpecification.
Performance Expectations
For full points, your solution should produce a correct file for a given .torrent. It must not rely only on seeds: its should download pieces from many peers, and it should finish significantly faster than simply getting all the pieces from the seed.
Turn-in Requirements
Check in the source code and Makefile in a directory named hw4 in your turn-in directory. Here is an example run:
make
./hw4 cs342files.torrent
Grading
There's no testing script for this homework. Points will be for:
- No trace of pthreads in the program. Try grep pthread and remove -lpthreads from the Makefile
- Consistently finishing download of torrents
- Significant upload activity (measured with tcpdump)
- Finishing faster than with only the seeds
- Concurrent connections supported
Handin
We will be using Handin to turn in all assignments. Turn this in for class 342, assignment 4.