Assignments
Links
Schedule
Syllabus

Assignment 1: Socket Programming

For this assignment, we will learn (or review) how to use network sockets in Java. We will use a network socket to transfer a serialized Date object. You will write two programs. The first program creates ServerSocket and calls accept() to wait for the second program, your client, to connect. The second program connects to the first by creating a Socket with which to read information from the server program. Once the programs connect, the server spawns off a new thread that sends the current time over the socket to the client.

You may find Sun's network and threading tutorials useful.

Objectives

Grading

  • D: Your code must compile.
  • C: All of the above, plus your code must establish a network connection and transfer the current time to the client.
  • B: All of the above, plus:
    • Your code must be cleanly documented and tested. It is your responsibility to create a test suite and submit its output.
    • Your server program must spawn off a separate thread to handle each client connection.
  • A: All of the above, plus
    • Your code must be cleanly written using class-member constants where appropiate and class methods
    • Measure average the time required to retrieve the time.
  • Extra credit: Implement, document, and test any of the following
    • Use an SSL connection. You may wish to consult Sun's SSL connection example
    • Use your own or another encryption method.
    • Use a GZIP stream to transfer information.
    • Measure average the time required to retrieve the time with and without the additional feature.