CMSC 433 Project 5: Robust P2P Messaging

Robust P2P messaging system

See:
          Description

Project files
cmsc433.p5 Basic framework for P2P messaging system
cmsc433.p5.clientDriver Client drivers for P2P messaging system
cmsc433.p5.messages Message implementations for P2P messaging system
cmsc433.p5.util Utilities for P2P messaging system

 
Sample Implementation
cmsc433.wp43301.p5 Bill Pugh's Client

 

Robust P2P messaging system

We start with some of the same basic concepts as before, but make the system more robust and less dependent on a central directory. Overall, the amount of code you need to write is about twice the amount of code for project 4.

Messages

The class Message is now an abstract class, with a GUID field (containing a RemoteClient and a sequence number) and a set of RemoteClients that have seen the Message. The class Message implements Runnable, so any message can have a arbitrary payload.

When a message arrives, check to see if a message with an identical GUID has arrived recently. If so, ignore the message.

Otherwise,

For each particular remote client, you should limit the number of outstanding messages you send to that client, in case the client is slow or deadlocked. There are several ways of implementing this.

If, in forwarding a message to a client, you get an error, you should remove that client from your list of known live clients.

Discovery

One way to learn about other clients is to receive messages. But of course, if you don't know any other clients, you can't bootstrap the process.

Every client must create an RMIRegistery on port x33yy, where x is your section number and yy is your account number. You must register yourself with that registry.

The arguments passed to initialize are a set of strings, each of which should be looked up using Naming.lookup and added to your list of live known hosts.

Create a Discovery object using the string appropriate for looking up yourself in your RMIregistry. Calling broadcast() on a discovery object will broadcast your RMI URL to every client on the LAN. Calling receive() on a discovery object will block until it sees a broadcast on the LAN and will return the string broadcast.

You should call broadcast once every 5 minutes.

You should have a try that just calls receive. For each string received, use Naming.lookup to look it up and add the client to your list of known live clients.