MP1: Group Chat

Due: 11:55 p.m. Feb 20

Overview

Your goal in this MP is to implement a distributed group chat system. A collection of users will each run a program that communicates with other users’ programs over the network. Your program will ensure reliable and causally ordered delivery of messages while detecting process failures.

Interface

Each program will start using the following command line:

mp1 name port n

The name represents the name of the chat participant; the port represents the port number to listen to for new connections, and n represents the number of people in the group.

The addresses of the chat participants should be hard-coded to your group’s VMs but the port should be specified on the command line. (This allows you to run when a port has not been completely freed up from a past experiment.)

Your program should print out READY on a single line when it has connected to all the group participants. At that point, the user can enter messages, one line at a time, to be sent to the rest of the group. As messages are received, they should be printed out prefixed by the name of the sender.

If a user has failed, you should print out that they have left the chat.

Below is a sample run of the program:

$ ./mp1 Alice 4444 3
READY
Hi everyone!
Bob: Hi Alice!
Charlie: Hey!
Bob: whoops, gotta go
Bob has left

Please use this exact output format in your program. If you want to add extra diagnostic messages, make sure they start with #.

Guarantees

Your system should ensure that messages are reliably delivered even in cases of node failure. Any node is permitted to fail. You will be tested with up to 3 simultaneous node failures. Your system should also ensure that messages preserve a causal order.

You should use TCP connections between your nodes to create a reliable, ordered transport. You may not use any existing multicast protocol implementation.

Your implementation should support between 2 and 8 chatting nodes.

Design document

Along with your code, you should hand in a brief (one to two pages) design document. The document should describe the algorithms/protocols you use in your implementation and how they are used to achieve failure detection, reliable delivery, and causal ordering. You should also include pointers to where parts of the protocol are implemented in your code.