Project 1 - Time/Date Client and Server
Due - Tuesday, October 18, 2005
The goal of this programming assignment is to give you an
opportunity to practice writing a program that communicates across
a network. You will use Java to write a reliable Client/Server
application.
Your application will provide time and date synchronization
between a client and a server. Your server will be capable of
receiving a request for the current time or the current date and
will return the requested information. Your client will be
capable of connecting to the server, sending a request for either
the time or the date, and receiving and displaying the response.
Your client must have a user interface that will enable the user
to specify whether she is interested in the time or the date and
will display the response. A completed program that provides a
command-line style interface will be eligible for 95% credit. To
be eligible for 100% credit, your program must implement a
graphical user interface using the java.awt or
javax.swing packages. You may find the following example
helpful:
UIExample.java GetListener.java
Your server may run as a single thread that accepts a connection,
processes the request, returns the result, and waits for another
connection. For extra credit, implement a multi-threaded server
such that the server launches a new thread to handle each
request.
The server should use the java.util.Calendar class to check
the time and date when it receives the client request. If the
client requests the time, the server should return a response of
the form hour:minute:second. If the client requests the
date, the server should return a response of the form
month/day/year. If the client sends an invalid request,
the server should respond with an error message.
Your first step is to develop the protocol the client and
server will use to communicate. Make sure to account for all
error conditions. Next, write the algorithm for both your client
and server and implement and test your algorithm. The
design of your code will affect your grade. In other
words, if your client and server consist only of a main method,
you will receive a low score for design.
For this assignment, you are to work individually. However, I
encourage you to discuss the high level details of your solution
with your classmates. For example, you might discuss the methods
and/or variables you will need for your solution.
A few other helpful hints.
On or before Tuesday, October 18, 2005 electronically
submit your protocol design, your algorithm and code design, and
all .java files required to compile and run your program.
Sami Rollins