CPSC 441: Computer Communications

Professor Carey Williamson

Winter 2014

Assignment 2: Pushmi-Pullyu (32 marks)

Due: Tuesday, March 4, 2014 (11:59pm)

Learning Objectives

The purpose of this assignment is to learn about some of the tradeoffs between TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) as transport-layer protocols. In particular, you will write a C or C++ program that implements a simple peer-assisted file sharing protocol, using either a pull-based or push-based design.

Background

In the late 1990's, the nature of the Internet changed dramatically with the emergence of napster as the first prominent peer-to-peer (P2P) file-sharing application. Napster was apparently designed and implemented by a college freshman (i.e., first-year student). It had a centralized server to keep track of files and participating peers, but used P2P transfers for the actual exchange of files, with a single large FTP-like transfer for each file. Many other P2P file sharing applications have emerged since napster was shut down in 2000, with some of the more prominent ones being Gnutella, KaZaA, eDonkey, eMule, and BitTorrent. BitTorrent in particular has many interesting design features, including chunk-based transfers of pieces of files, rather than entire files. These chunks can be obtained concurrently from different participating peers, which provides a very scalable "bandwidth harvesting" mechanism for high performance data transfers.

Technical Requirements

In this assignment, you will design and implement a simple peer-assisted file sharing application, and test it on a network of your own choosing. Your application will make use of a central server, which provides a repository for storing files and keeping track of participating peers. The server will have a single file available. Each peer contacts the central server to find out what other peers are participating, and what pieces of the file each peer has. Most of the time, peers use P2P exchange of pieces to advance their progress in downloading the file. If no peers have useful pieces, then a piece can be obtained from the server. This approach is called peer-assisted file sharing.

Your application can use either UDP (i.e., datagram sockets) or TCP (i.e., stream sockets) for its underlying transport-layer protocol. This choice is entirely up to you, but you will need to provide justification for your design in the documentation that you submit. With TCP, reliable data transfer will be provided automatically, but there will be a lot of transport-layer connections to keep track of. With UDP, the transport-layer endpoints will be simpler to manage, but you may need to add some reliable data transfer mechanisms (e.g., timeouts, retransmissions) in order to make your protocol work.

Your application can use either a pull-based design or a push-based design (your choice). In a pull-based design, a participating peer A who needs piece i would consult the server to find a peer B who has piece i, and then contact peer B to download piece i (i.e., similar to a GET in FTP). In a push-based design, a participating peer A who has piece j would consult the server to find a peer B who needs piece j, and then contact peer B to upload piece j (i.e., similar to a PUT in FTP). Since either design approach is possible, we will call this file sharing application Pushmi-Pullyu, named after one of Doctor Dolittle's legendary creatures. (Here is a rare photo, courtesty of BBC News.)

There are several important configuration parameters in Pushmi-Pullyu (PP for short):

Grading Rubric

The grading scheme for the assignment is as follows:

Bonus (4 marks): Extend your solution as necessary so that it can successfully handle N = 8, P = 8, C = 8192, and M = 32 for a single 256 KB ASCII test file.

When you are finished, please submit your assignment solution to your TA via D2L. Your submission should include your source code and user manual documentation.

Tips