
CS/ECE 757 – Computer Networks
Fall 2004
Assignment 1: Programming with Sockets in Java
Instructions:
• This assignment is to be completed individually.
• The only help you are allowed are the textbook, the online documentation at www.javasoft.com
or www.sun.com, the material on the web which is listed on the CS 757 website, and a book on
the Java programming language.
• The grade for this project is weighted as follows:
• 50% Implementation
• 20% Functional Tests
• 30% Write-up
Due Date: September 16, at the beginning of class.
Objective: Implement an Addressbook service.
Problem Description:
• The Addressbook service is a client-server application. A client sends a query message to the server
containing an email address. The server responds to the client with a message that contains the full name
which corresponds to the email address.
• A client process Addressbook_client submits query messages to the server. The query message contains
an email address.
• The server process Addressbook_Server runs on a known workstation (say, `cobra.cs.virginia.edu’) and
listens on a well-known port number for client requests. When a request comes in, the server looks in a
file to find the full name which corresponds to the email address, and sends the full name to the
requesting client.
• The following messages format is used for query and response:
Message Type
(1 byte)
AString Length
(1 byte)
AString
(≤ 255 bytes)
• Message Type is set to “Q” (ASCII 81) for queries, and “R” (ASCII 82) for responses.
• AString Length is an unsigned 8-bit integer.
• AString is a character string with up to 255 characters.