Project 1 - Message of the Day

Part 1 - Due - Wednesday, February 11, 2004

Part 2 - Due - Wednesday, February 18, 2004

The goal of this assignment is to give you some experience with Java, socket programming, and graphical user interface (GUI) development. This assignment is to be done individually. Any help received from any source must be cited.

Your assignment is to write both pieces of a client/server program. Your server will store a "Message of the Day" which can be requested and/or modified by a client. Your client will be able to retrieve the message of the day and display it for the user and also change the message of the day to a message specified by the user.

The first part of this assignment is to define the protocol that the client and the server will use to communicate. Your protocol should allow the client to REQUEST the current message or STORE a new message. It should also allow the server to respond with the CURRENT message of the day or to indicate that the client's new message was stored OKAY.

Server

Your server will:
  1. Start-up by setting a default message -- you can specify any message you like.
  2. Open a socket and wait for a connection from a client.
  3. If the client sends a request for the current message of the day, respond with the current message (using the appropriate protocol messages).
  4. If the client sends a request to store a new message of the day, overwrite the current message of the day and inform the client that the message was stored successfully (using the appropriate protocol messages).
  5. Open a new socket and wait for another connection.

Client

Your client will:
  1. Display a user interface with components that will (1) allow the user to specify that the current message of the day should be retireved (e.g., a Button "Get MotD"), (2) display the current message of the day once retreived (e.g., a TextField), (3) allow the user to enter a new message and specify that her new message should be sent to the server (e.g., a TextField and a Button "Store MotD").
  2. If the user requests the current message of the day, open a socket to the server, send the appropriate protocol message to retreive the message of the day, display it for the user, and close the socket.
  3. If the user asks to store a new message, open a socket to the server, send the appropriate protocol message to store the new message, send the appropriate protocol message to retrieve the new message, and display it for the user.
The following pieces of code should help get you started:
Socket Examples: TCPClient.java TCPServer.java
UI Example: UIExample.java GetListener.java
A few other helpful hints.

Part 1 Turnin

For Part 1, you need to turn in a full specification of the protocol your client and server will use to communicate along with an example that illustrates how the messages will be used. Your specification should include all protocol message that will be used by your client and server and how each entity will respond when receiving each message. I suspect your protocol will conisist of about 4 messages.

Part 2 Turnin

For Part 2, you need to turn in your code (.java files), and a description of the test cases you ran. Turn in all pieces via email by class time on the due date. Your code should include at least two classes, a client and a server. You will be graded on your design, your implementation, and your documentation. Your test run description should be about a page in length.

Sami Rollins