Assignment #4 - Peer-to-Peer File Sharing Gnutella Style

Demo on Monday, November 17 or Tuesday, November18.

Assignment overview:

In this assignment, you will implement the query flooding protocol used in Gnutella (a peer-to-peer file sharing technology). It is said that the two Gnutella inventors spent 14 days to design and implement a prototype system. It should take you much less time in simply following their ideas and implementing a small part of the complete protocol. You do not need to add a file retrieval mechanism into the search system, which would be needed for a complete file sharing system.

Requirements in detail:

A specification of the Gnutella query flooding protocol can be found here. For your relief, you are asked to implement a small part of the protocol, which will be explained below. You will not need to read the Gnutella specification to complete this assignment. The requirements we give below are not always specific. You can design your own packet format and so on as long as systems running your protocol behave as we specify. So your system may not work with Gnutella-compatible nodes, but nodes implementing your protocol should be able to inter-operate. Your protocol should run on top of a transport-layer protocol, e.g. TCP.

A key concept behind peer-to-peer technologies is that all the nodes are functionally equal to each other. In particular, all the nodes will run the same code.

Every node should start up with the following input:

Below are the desired behaviors for peer-to-peer file searching through query flooding:

Here is an illustration of what query flooding looks like (with an initial TTL=2).

You will need a user interface for your system. A text-based interface is sufficient, but a GUI would be most welcome :). Your program should print out all activities including query propagations and query hits at the runtime.


You will need multiple machines in your testing. And others may do the same at the same time. You may need to coordinate on using different port numbers so that your programs don't to interfere with each other.


This assignment will be primarily examined by a 20-minute demo with the TA. The TA will send out information on how to set up a demo slot. The earlier you sign up with the TA, the more available slots are there that you can choose from. Once your demo slot is set, we will not be able to change it unless there is an emergency.

You are also asked to prepare a README file which should serve as a high level summary of your work, explain your design, what is and what is not realized in your implementation. Moreover, it should describe the packet format for neighborhood establishment and query propagation. The TA may (or may not) try to run your program after the demo, so make sure your README file also describes clearly how your program should be compiled and run. Please make sure that you have a hard copy of the README file ready at the beginning of your demo.

You should electronically turn in your source files, a makefile if needed, and the README file before or right after the demo.


Late turn-in policy:

At the absence of any emergency, you must make your arranged demo time. Otherwise you will get no points for this assignment.