CS 457/557: Warmup Programming Assignment

Due September 8, 11:59 PM.


This assignment is intended as a “warm-up” assigment, to get you familiar with using UNIX, etc.

The task is to implement a simple command-line-based chat program, consisting of a single server and multiple clients. The server should accept incoming messages, and send them to all clients. You may use either UDP or TCP for this assignment, though I suggest TCP. You may use either Java or C++, or some other language, if it is available.

Upon startup, your server should print one line to standard output. This line should contain the information needed by your clients to contact or connect to the server.

Your clients will be passed this line as a command-line option when starting. After starting, your client should read lines from the standard input, a line at a time. Every line should be sent to the server. The server should then send it to every running client, except the client that sent the line. When a client receives a line from the server, it should write it to standard output.

Your program should not have any built-in limitations. It should be able to work for any number of clients, except as limited by network or hardware limits. It should work for any length of messages.

Your program should not have any memory leaks, or any other resource leaks.

The binaries for the solution are given here. Your submission should be runnable in the same way, except that you may use a different format for the single line printed by the server, as long as we can just copy the whole line and use it as the command line arguments to the client.

Submission and Evaluation

Your code must run on the classroom machines. You should e-mail a compressed (gzip) tar file containing your source and a Makefile to the class internal mailing list. After running make, there should be executables named server and client in the top-level directory.

A very simple makefile that will work is given below.

PHONY: all
all: server client
server:
	g++ -g -o server file1.cpp file2.cpp ...
client:
	g++ -g -o client file1.cpp file2.cpp ...

Note the compile line must be indented with a real tab, and not just spaces.

If you are using Java, you must still submit a makefile, and conform to the naming. This is because grading will be assisted by scripts.

Your grade will be based on correctness and level of performance. Correctness will include whether or not your output is correct, and whether or not you can scale, or have any memory (or other resource) leaks.

You must accept the specified input format exactly, produce the specified output format exactly, and follow the submission instructions exactly. Submissions that do not conform to these requirements will not receive credit.