CS 450 - MP 3

Spring 2005

P2P Chat

Program Due: Wednesday, April 27, 2005 at 11:59 pm

Short presentations are to be given in class on Thursday 4/14/2005. These presentations are to discuss any implementation and protocol issues that you are planning on using in your program. Every group must make a presentation. The whole group does not have to take part in the presentation. One member of the group can be volunteered to give the presentatation for the entire group.

You may work on this program in groups of upto 4 students.

For this program, you are to create a P2P (Peer-to-Peer) Chat program. When communicating with another peer, your program is to directly communicate with that other peer. Each peer is to maintain a list of other known peers. This "Last Known Location" list is to contain the peer's name, host, port and time of last known login. When trying to connect to another peer the information in its "LKL" list will be used to attempt to connect to the peer for a chat session.

There are two types of communication operations that can occur between two peers: synchronize and chat.

When peer A attempts a chat session with peer B, information for peer B must be in peer A's LKL list. This information will be used to contact peer B. If peer B is currently running at the location in peer A's LKL list, the two peers will be connected. Once connected, a synchronize operation will occur first followed by a chat operation.

If peer B is not running at the location in peer A's LKL list, it may be running at some other host/port or it may not be currently running. To see if peer B is running at some other host/port, peer A will attempt to connect with all other peers in its LKL list and for each connection perform a synchronize operation. If these synchronization operations cause the information in peer A's LKL list to be updated for peer B, a second attempt to contact peer B is to be made. If no updates are made or the second attempt to contact peer B fails, it will be assumed that peer B is not currently running and a message stating this is to be given to the user.

The primary interface for this program is

and allow the operations

When exiting the program, the peer's name, port and LKL list are to be stored in a file that will allow the peer to be restarted without losing its information. The filename should reflect the peer's name.

When starting the program, a file may be specified as a command line argument. This file should contain information that was saved during the exiting of the program. If a command line argument is not given, the user should be prompted to create a new peer or to select an file containing information for an existing peer. When a new peer is to be created, a name and port number is to be given by the user. It will be assumed that a unique name is given. There are no defined specifications if a unique name is not given. You program can do anything reasonable if a non-unique name is given (I don't think a core dump is reasonable, but just about anything else is).

If the port used by the peer is in use when the program starts, the user should be prompted for one of three actions:

A peer's LKL list is to contain information about itself. The time is to be the time when the peer began its current execution.

One question that I will leave for you to answer is, "When a peer's information is manually added to the LKL list, what time value should it be given?"

Below are some idea that I had regarding the layout of GUI's for this program.

The main window:
Name: A
Port: 12345
Last Known Location Information:

A chat window:
Name: Mark
Host: ernie.cs.uic.edu
Port: 23123
Incoming Messages:

Outgoing Messages:

Submission of the program

Your program is to be submitted electronically via the turnin command on the LINUX machines. The project name for this is mp3. All programs are expected to be written in good programming style using the java programming language.

Submit your program electronically using the "turnin" command from your CS account as follows:

turnin -c cs450 -p mp3 [your project directory]
where the [your project directory] is the directory name under which you have all your files related to this programming problem. The turnin command will automatically compress the data under your directory, so there is no need to do the compression by yourself.

Notice you can only invoke turnin command on the Linux machines in the lab or after logging into the server machine oscar.cs.uic.edu.

If you want to verify that your project was turned in, use the verify option -v with the turnin command. For instance for this project, from your CS account you would type:

turnin -c cs450 -p mp3 -v

Note that you can execute turnin as many times as you would like, up until the program deadline when turnin will be disabled for this project. Each time you execute turnin for a project, you overwrite all of what you had turned in previously for that project. Turnin does not allow for incremental submission of your project.