Assignment 1: Centralized File Sharing System


  • Initial design spec due on September 10, Wednesday, 11:59 PM.
  • Design review meetings on Sept 11/12.
  • Complete code and documentation due on Sept 18, Thursday, 11:59 PM.
  • Peer-to-Peer File Sharing System

    The goal of this assignment is to design and implement a simple Napster-like file sharing system. Here are some high-level design requirements of your system.
  • A centralized server keeps track of which clients store what files.
  • A client informs the server as to what files are contained in its local repository, but does not actually transmit file-data to the server.
  • When a client requires a file that does not belong to its repository, a request is sent to the server. The server identifies some other client who stores the requested file and sends its identity to the requesting client. The file is then directly fetched by the requesting client from the node that has a copy of the file without requiring any server intervention.
  • Multiple clients could be downloading different files from a target client at a given point in time. This requires the client code to be multithreaded.
  • The client has a simple command-shell interpreter that is used to accept two kinds of commands.
  • publish lname fname: a local file (which is stored in the client's file system at lname) is added to the client's repository as file named fname and this information is conveyed to the server.
  • fetch fname: fetch some copy of the target file and add it to the local repository.
  • You are free to use any programming language (C, C++, Java, etc.) and any mechanism for communicating between machines (such as TCP, UDP, RPCs, etc.). We have provided some sample code for establishing a TCP connection between two nodes and exchanging a pair of strings. Note that the server forks a new pthread to handle each client. The code is available on the Zoo machines at /c/cs425/as1code.

    Submission Instructions

    We are going to use the most primitive form of submission! Just tar and compress the directory containing all the files and email it to the instructor (arvind@cs.yale.edu). To tar and compress the directory "as1code," use the following command: "tar cf - as1code | gzip -c > as1code.tar.gz." Then email the tar-ball as an attachment. Please make sure that the directory does not contain any core files or large files that were used for testing.

    Things to include in your submission:

  • A readme file describing how to run the system
  • Source code (with comments where needed)
  • An updated version of the design document that reflects the current design