SDSU CS 580 Client-Server Programming
Fall Semester, 2002
Assignment 2
    Assignment Index        
© 2002, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 30-Sep-02

Assignment 2 – Adding Numbers
Due Oct 10, 2002


1. Write an iterative server (no threads) to add numbers.

Client Request
When the client connects to the server it will send a command followed by a carriage return (ASCII character 13) and line feed (ASCII character 10). After the line feed will be the arguments for the command. A semicolon (;) separates arguments. Spaces before and after arguments are optional. A carriage return and line feed is placed after the last argument. Arguments are integers.

There is only one command: add. The command is lower case. The following is an example of the add command:

add<cr-lf>3;4;  6; 12; -13<cr-lf>

<cr-lf> indicates a carriage return followed by a line feed

Server Responses

The server has two basic responses: ok and error.


The response to a valid client request is ok followed by <cr-lf> followed by the sum of the numbers followed by <cr-lf>. As a server only handles one request per connection, the server then closes the connection. The following is the response to the above request.



If the client sends an illegal command the server should respond with:

error<cr-lf>Invalid command<cr-lf>

If the client sends a correct command but the arguments are not valid numbers or the arguments are not correctly formatted the server should respond with:

error<cr-lf>Invalid arguments<cr-lf>


The assignment is to be done using the language in which you qualified for the course: Smalltalk or Java.


Percent of Grade
Working Code
Quality of Code
Unit Tests

Working Code. How well your code meets the functional requirements listed above accounts for 30% of the grade for the assignment.

Comments. Having the appropriate comments in your code will count for 10% of the grade.

Quality of Code. Having good quality of code counts for 30% of the grade. Quality of code includes formatting, names and modularity.

Unit Tests. You should have JUnit or SUnit tests for the non-network portion of your code.

What to Turn in

Turn in hard copy and an electronic copy of your code for problem 1. Java people need to place an electronic copy of your code in a CVS repository in your class rohan account (which will be handed out in class). Your account needs to have the environment variable CVSROOT defined. You need to define a module assignment2. Check out the assignment2 module should give the code for this assignment. This includes the unit tests. Smalltalk people need to place their code in their store repository. Details of your store repository will be emailed to you.

Late Policy

See the course syllabus for the late policy.

Copyright ©, All rights reserved.
2002 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 30-Sep-02