CSCI561 - Computer Networks

Program One

Download and compile Stevens' example code which is located at http://unpbook.com/src.html Using your browser, shift click the "source code" link to get the archive file. To solve problems you may have to "hunt" for the system header (include) files and some of them may have to be copied into your directory and modified before his code will compile. Also you may get a library error and have to explicitly specify the library (i.e. -lxxx).

If you are having trouble downloading the file you can copy it from here: UNP 3rd Edition Source Code

Run tar tar -tvzf unpv13e.tar.gz to see the table of contents and the directory it will create when unarchieved. Run tar again tar -xzf unpv13e.tar.gz to unarchive the source code. And save the archieve in the new dirctory mv unpv13e.tar.gz unpv13e, then read the README file. If you're lucky all you have to do is the following:

Run the configure utility to conform to your version of Unix:

./configure

Compile Stevens' library code:

cd ./unpv13e/lib
make

Next, complie Stevens' Demo Client and Server

cd ../tcpcliserv
make

To test it locally, run the server

./tcpserv01 &
Then run the client
./tcpcli01 127.0.0.1
Remember, there is no prompt, but the client is waiting and if you type "hello," it will respond with hello.
hello
hello

Once the sample code is complied and working, modify Stevens' echo server/client code (str_echo.c and str_cli.c) with additional messages indicating which lines are being sent from which agent. Have agents print each line out to stdout for debugging.

Also, do not use Stevens' port 6000 for the server, instead use the last four digits of your student ID as the port number. That way each server will be unique and can run on multiple machines

Re-compile the source directory:

cd ./unpv13e/lib
make
cd ../tcpcliserv
make
Or re-compile the file directly with:
      gcc -o tcpcli writen.c readline.c strcli.c tcpcli.c
      gcc -o tcpserv writen.c readline.c strecho.c tcpserv.c

Program output per line -
you type: Helllloooooooo! client shows on local tty and sends: Client sending - Helllloooooooo! server shows on local tty and replies: Server sending - Helllloooooooo! client catches the response and shows: Client from Server - Helllloooooooo! (Be sure to include similar agent labels as above.)

Finally, please clean up your server processes. Please do not leave them laying around for someone else to kill. They will fill the process table and prevent others from completing the assignment. Thank you.

Once the program is working properly, use the script program (type "man script" to see how to use it) to show your source changes, the compiler output, and the execution of the server & client. Print out the script file and hand it in to me on Tues, Sept. 10th.

Local Bug Report

If you kill your server and restart it, you may get an error because the TCP TIME_WAIT interval has yet to expire.

Possible problems with using Ubuntu:

a) Gcc does not work

   dowmload gcc with the command
   sudo apt-get install gcc
   password: (type in the password located on the whiteboard)
   Bunch of status lines...
   Hit  or Y

b) Error messages about not finding stdio.h or crt1.o

   dowmload the C include files with the command
   sudo apt-get install build-essential
   password: (type in the password located on the whiteboard)
   Bunch of status lines...
   Hit  or Y