Networks

Project 2


We going to write a simple fortune cookie server. That is, you need to write two pieces of software: a client that sends requests for a fortune cookie to display, and a server to provide the fortunes upon request. Note that you should pick a partner and work in pairs on this project.


Communications requirements

There are a few critical requirements for the communication between the client and server:

The server and client should be invoked, respectively, like so:

remus:~> java FortuneServer 2468
romulus:~> java FortuneClient remus 2468

That is, the server should be provided a port number on which to listen. Similarly, the client should be provided both the server's hostname and the port number. Your group should randomly select a single port number between 10,000 and 65,636 and use it consistently. Be aware of the small possibility that two groups will pick the same value, and thus interfere with one another.

Your client and server interaction should follow a specific sequence of steps:

  1. Establish a connection using sockets.
  2. The client sends the server its public key.
  3. The server encrypts a fortune using that public key and transmits the encrypted fortune.
  4. The client decrypts the fortune and displays it to its user.
  5. Disconnect.

Java classes you will need

Communication via sockets requires use of some special Java classes.

To find out more about these classes, see the Java 6 API documentation. This page will allow you to browse these (and all of the other standard Java) classes, seeing all of their methods and descriptions of those methods.


Submitting your work

Submit your FortuneClient.java, FortuneServer.java, and any other supporting source code like so:

cs29-submit project-2 *.java

This project is due at 5:00 pm on Friday, 2008-May-09.


Scott F. H. Kaplan
Last modified: Fri Apr 25 06:37:41 EDT 2008