Assignment 6

Assignment

In Assignment 3, you wrote a daytime server using TCP. This time, write a daytime server UDPDaytimeServer.java using UDP. Your UDP server waits for a query. When a datagram is received from a client, the server places the current date and time in a datagram and sends it to the requesting client.

A daytime server usually runs on port 13, and you should use this as the default. However, running a server on port 13 requires root (superuser) privileges, and so you should allow another port to be specified on the command line when your server is started. For example, to run your daytime server on port 1313, you would type

java UDPDaytimeServer 1313

If no port is specified on the command line, the default port 13 is used.

To make the assignment a little more interesting, we incorporate an additional feature. In order for the client to receive the current date and time, the client must send the query

Please send the date and time.

In this case, your server returns the current date and time to the client. If the client sends any other query, your server responds by sending

I don't understand your request.

Testing

How do you test your server? One way is to write a UDP daytime client by slightly modifying the UDP echo client example given in class. However, a UDP daytime client is not part of this assignment and should not be submitted with your UDP daytime server.

Groundrules

See the rules for programming assignments on the main course Webpage. You may work individually or in teams of two or three people.

Submission

As noted on the main course Webpage, assignments are to be submitted electronically as e-mail attachments. Use the address

contst10@cs.gettysburg.edu

The e-mail message itself must contain the Honor Pledge and the full names of the people submitting the assignment. Only one submission should be made for each team. Once again, you should submit only the UDP daytime server and not any UDP daytime client you wrote to test your server.

Due Date and Time

This assignment is due at 12:01 AM on Wednesday, March 28. Late work is not accepted, but early submissions are welcome!