MCS-378 Homework 5, Fall 1999

Due: December 3, 1999

This howework is essentially a mini-lab, involving the socket model for how a network server can operate. (We'll do a full-sized lab using RMI.)

Versions of the Server.java, Connection.java, and Client.java files from Figures 15.2-15.4 are in the directory ~max/MC78/1999-Fall/src/chap15/sockets/. (These versions are the ones the authors have made available on their web site. They are not identical to the ones in the book. In addition to bug fixes, the Connection class is changed to repeatedly provide the date and time, rather than only once.)

First, make sure you understand how to compile and run these programs by doing so. In particular, make sure you can use telnet to access the Server. (You can use the name "localhost" rather than 127.0.0.1, or can telnet using the actual hostname, even from another machine.) Next, modify the Connection.java file (and possibly also the Server.java file) so that the server no longer prints out the date and time, but instead does the following:

Your new server won't be usable with the java Client, just with telnet. Try your new server out. Run it, and then repeatedly telnet to it. (As before, you can do so from different machines, or on the same machine using localhost.) Make sure that each time it reports the line of input that was provided the previous time, except the "First time."


Instructor: Max Hailperin