MAT 201B / CS 290I-- Media Networks and Services
Homework Assignment #1
TURNED IN BEFORE Class on Thursday 10/12/00

Assignment Overview

The purpose of this assignment is to experiment with simple socket programming, both in C and in Java. The basic funcationlity you will implement is a client and server who communicate over a network. The server functionality is to reverse a given text string of up to 80 characters length. The server is expected to run on one machine (a well-known address (IP address + port number)) waiting for requests. Your client code will contact the server and pass it a string. The server will then reverse this string and send it back to the client. The client will display the received string and exit.

NOTE: This assignment may be performed in groups of two. However, each student is expected to contribute equally and each student must turn in an assignment (though they may be nearly identical). See turnin section for further instructions.

Example

Assume that you started a server on machine 128.111.49.44, listening to port number 32000. The syntax should look like the following:

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

Then you ran a client at a machine using the following arguments:

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

At this point (after receiving one line to be reversed), the server should exit:

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

Your task is to write such a server and client programs in C and in Java using UDP 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 on the terminal 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) will be counted as an incorrect program.

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. Also, if you worked in a group of two, make sure that you list your name and your partner's name in the code. Finally, it is highly recommended that if you copied code from some reference that you include a note giving full credit to the author of the original code, and where you obtained that code. 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.

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 the points count towards how well 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!