CIT 597 Assignment 5: A “Chat” Server and Client
Fall 2003, David Matuszek

Purposes of this assignment:

Idea of the assignment:

In this assignment you will write a simple chat server and client. Each client connects to the server, sends it messages, and displays messages received from the server. The server accepts messages from every client and broadcasts them to every client.

In more detail:

The client and server connect using Sockets, and exchange messages using a protocol. The protocol should be one that you invent—don't try to use the HTTP or IRC protocol, both of which are far more complex than you need.

The client should send (at least) these kinds of messages to the server:

The server should send at least these messages to the client:

There are many more messages that the server might send to the client. You are not expected to do any of these. This is more along the lines of things that you might do if you wanted to improve the program.

The server program must be multithreaded. It should have a separate Thread for every connected client.

The client program needs a GUI. The GUI needs to allow the user to (1) enter a name and connect to the server with that name, (2) enter text messages and send them, (3) receive messages, and (4) disconnect from the server. It should display the last several messages in a scrollable text area, and each messages should have the name of the sender appended to it. There are no special requirements on this GUI, just the usual ones of being as simple and obvious as possible.

The server program does not need a GUI. It should "just work." However, you might want to supply a GUI anyway, for testing purposes or maybe to see who is connected.

Don't make this assignment any more complicated than necessary. The purpose is to get you started with sockets, protocols, clients and servers, and multithreading. Although good error checking and interesting features are always desirable, that isn't the purpose of this assignment.

I do expect:


You may work with a partner, or you may work alone--that's up to you. If you work with a partner, both of you are responsible for all of the code. Please turn in one copy of your assignment.

Due date:

Wednesday, October 22, before midnight. Turn in a zipped set of files via Blackboard.