CS 176B -- Network Computing
Homework Assignment #1
Due by 11:59pm on Wednesday, January 23, 2002

Assignment Overview

The purpose of this assignment is to give you experience writing programs that implement sockets. Sockets are the key interface between applications and the Internet. In this assignment you must program both TCP and UDP sockets. For full credit, you must also write sockets in both Java and C. Finally, this assignment will also serve as the basis for Assignment #2.

The basic funcationlity you will implement is a client and server that communicate over the Internet. The server is essentially an echo server but with some additional functionality. Instead of simply echoing the string it receives, the server returns a string with all upper case letters replaced by lower case letters and every space changed to a `.'. See below for an example.

The server will receive a text string of up to 80 characters length. The server is expected to run on one machine and wait for requests. Your client code will contact the server using its host address (IP host or address and port number) and pass it a string. The server will then change this string and send it back to the client. The client will display the received string and exit.


Assume that you started a server on machine dagwood.cs.ucsb.edu listening to port number 32000. The syntax should look like the following:



Then you ran a client on a machine (blondie in the example) using the following arguments:


Important points:

Your task is to write client and server programs in C {\it and} in Java using UDP {\it and} TCP. You will end up writing (and turning in) 8 different programs:

You will be turning in 8 (and only 8--no header files... NOTHING else) files as named above. Your server should not output anything (status, debugging messages, etc.) and your client should have the exact same interface as given in the above example. (Code will be run against an automated checker... any deviation (e.g. printing additional messages, etc.) will be counted as incorrect.

In order to compile your C code, use the following commands as a guide:

To compile your Java code, use the following commands as a guide:

Assignment Turnin

You should turn in the source code for the 8 programs you wrote. (There is no hard copy turnin for this assignment.) Be sure to include your name in each program that you turnin. To turn in assignments, use the following command from the Computer Science CSIL lab: NOTE: The final "hw1" is a local directory containing the 8 and only 8 programs you are turning in. Be certain to name this directory exactly "hw1".

ANOTHER NOTE: It is highly recommended that you use the CSIL machines to do this assignment. All of the tools you will need are available there; it significantly improves our ability to help you if you have problems; and it ensures that if your programs work there, they will work when we grade them.

Assignment Grading

In addition to correctness, part of your grade will depend on how well your code is written and documented. NOTE: good code/documentation does not imply that more is better. The goal is to be efficient, elegant and succinct!