Homework 3
Due Monday, May 3

Make sure to combine all required files, for both problems, into one large .tar file. Remember that when a requirement is explicitly stated, it is required.

Problem I:

In this problem you will write a pair of programs whose goal is to illustrate the following two points:

Name your program source files Sender.c (the server) and Counter.c (the client), and the corresponding executables sender and counter. The command-line usage will be:

sender chunk_size number_of_chunks reuse
counter hostname

For sender reuse = 1 means that the socket is to be immediately reusable, and 0 means not.

The main part of sender will consist of a loop whose main action is to call write() to send chunk_size bytes to counter. The loop will execute number_of_chunks iterations. The sender will then terminate. (Note that since the purpose of the program is to serve as an experiment to investigate TCP traffic patterns, it does not matter which bytes you send. Thus you might as well send 0s.)

The main part of counter will consist of a loop whose main action is to call read() and report how many bytes are received in that call. There will be an indefinite number of iterations, looping until read() returns a nonpositive value. Also, this program will report at the end as to how many total bytes it received, which should match the number sent, chunk_size * number_of_chunks.

Be sure to run the server and client on different networks, say running counter on CSIF while running sender at ACS.

The files you submit for this problem will consist of (a) your source files and Makefile and (b) the output files from running script to record what happens when you run the programs. Again, remember that these files must illustrate the fact that the sizes of the chunks received by read() need not match those send by write(), and also must illustrate the fact that a socket can't be immediately reused unless SO_REUSEADDR is set. (Show both that it can't be reused if that option is not set, and that it can be reused if it is set.)

Problem II:

Here you will so some calculations on the relation between frequency range and bit rate, very similar to what is discussed in the handout.

Your analyses must be written up in LaTeX. Also, you will be asked to do some graphing, in which you must use either gnuplot or jgraph (I recommend the latter), generating Encapsulated Postscript files.

Review the example in the handout. Suppose, as in the example there, we are sending at the rate of 2 MHz. Consider the bit pattern 1001100110011... The waveform would have the value 1 between -T/2 and -T/4, -1 between -T/4 and T/4, 1 between T/4 and T/2, and so on.

Graph the third, fifth and seventh Fourier approximations to the desired waveform. By this I mean that k, in 2 pi k f0 t, has a maximal value of 3, 5 and 7, respectively. (The graph in the handout has k = 5.) State the minimal bandwidths (i.e. frequency ranges) a transmission medium would need to transmit each of those three Fourier approximations.

The files to turn in here are your .tex (showing your math work) and .eps files.