CS 3410: RPC Chat System


In this assignment, you will write a simple chat server and client. You will use the net/rpc package in the Go standard library to manage communications.

As a user, you will interact with the client. When you start it, you must supply it with your handle and an optional server address:

./chatclient alice

(this connects to localhost:3410). Or

./chatclient alice :3411

(this connects to localhost:3411). Or

./chatclient alice krypton.cs.dixie.edu

(this connecst to krypton.cs.dixie.edu:3411). Or

./chatclient alice krypton.cs.dixie.edu:3411

It will connect to the server and register you as a user. In addition, it will get a list of all users currently logged in, and present that list to you:

Hi alice, connecting to localhost:3410...
List of users currently online:

Then you can type commands. The client understands the following commands:

In addition to responding to your commands, the client will fetch messages being sent to you and display them on the terminal.

The server

The server sits and waits for incoming RPC requests. It keeps a queue of messages for each user currently logged in, delivering them to the client when the client requests them.

When you start it, you can supply a port number and/or address to listen on, or you can accept the default (port 3410 on all network devices).



./chatserver -port=3411

It provides the following functions over RPC to clients:

The server maintains a queue of messages for every user currently logged in. A user queue is emptied after a CheckMessages transaction when all of the messages have been returned to that user.

The client

The client parses the command line and connects to the server with a Register message. It then enters a loop:

Implementation details

What to pass off

You should record a screencast tto demonstrate your programs to me. Set up at least four terminal windows: one with a server and three with clients. Demonstrate all of the required functionality in a brief screencast.