CSS 432
Program 3: TCP Analysis
Professor Dimpsey
This assignment will focus on the behavior of the TCP protocol through a number of experiments. There are two major sub-tasks that make up the assignment, each of which requires a seperate program. These programs can be found in the /CSSDIV/classes/432/hw3 directory on the UWB Linux lab systems.
First, the hw3 program will be utilized as a basis for drawing the TCP state transition diagram as well as a corresponding timing chart. You will also be required to write your own program mimicing hw3. This will help re-enfore the sequence of system calls underlying the TCP protocol.
Second, you will run the ttcp program with a number of different parameters effecting the message size, the number of messages transfered, the socket buffer size, and the use of Nagle's algorithm. Note that there is also a version of ttcp at /usr/bin/ttcp, but we will not be using that version. Get ttcp from the directory, /CSSDIV/classes/432/hw3, on the UWB Linux lab. Using the tcpdump, netstat, and strace commands you will observe how TCP segments are transmitted.
Usage: ttcp -t [-options] remotehost ttcp -r [-options] where: -t transmit data -r receive data common options: -l# length of bufs read from or written to network (default 8192) -b# set the socket buffer size if supported (default is 16384) -p# specify another service port (default is 5001) -? print this help options specific to -t: -n# number of source bufs written to network (default 2048) -D don't buffer TCP writes (sets TCP_NODELAY socket option)You will need to start ttcp on the server computer first and then start it on the client computer. Use the -r argument on the server and the -t option on the client. For instance, if we assume csslab2 is the server and csslab1 is the client, the following would be executed:
[user@csslab2]$ ./ttcp -r [user@csslab1]$ ./ttcp -tGiven the -r option, ttcp will keep running as a server to repeatedly accept a new TCP connection and to sink all data received along the connection until a user specifically terminates it with a "control c" key input. On the other hand, the -t option directs ttcp to make a new TCP connection to a server, to send messages to it, and to terminate the program.
tcpdump -vtt host hostname and port port and tcpwhere hostname is a remote IP name and port is the port of the TCP connection to access. Note that the port must be larger than 5000.
If you use csslab1 as a ttcp client and csslab2 as a ttcp server, you should start the server and then open another xterm at the client end to run tcpdump as follows:
Since the tcpdump displays all exchanged packets, the amoun of data produced is overwhelming. netstat is a much more concise tool which can retreive useful network statistics. In particular, you will be interested in obtaining the summarized statistics of tcp packets. Learn how to use netstat through "man netstat", and confirm that -st is necessary to display the number of tcp packets sent, received, and retransmitted so far.
Invoke netstat right before and after the execution of "ttcp -t". The actual number of tcp packets exchanged can be calculated as a difference in the statistics between those two invocations of netstat.
[user@csslab1 hw3]$ netstat -st | grep segments [user@csslab1 hw3]$ ttcp -t [-options] csslab2 [user@csslab1 hw3]$ netstat -st | grep segments
[user@csslab1 hw3]$ strace -ttT ttcp -t [-options] csslab2 >& resultsThe traced results are saved in the results file. Note that we are interested in write system calls onto a particular file descriptor, (i.e., a socket opened by ttcp). The file descriptor numbers 0, 1, and 2 are stdin, stdout, and stderr respectively. To view only write system calls onto this socket, you have to invoke the following cat and grep with an appropriate keyword.
[user@csslab1 hw3]$ cat results | grep [keyword]
The general execution format: xterm 1 (server side): [user@csslab2 hw3]$ tcpdump -vtt host clientHostName and port portNumber and tcp xterm 2 (server side): [user@csslab2 hw3]$ hw3 portNumber xterm 3 (client side): [user@csslab1 hw3]$ hw3 portNumber serverHostName An example: xterm 1 (server side): [user@csslab2 hw3]$ tcpdump -vtt host csslab1 and port 12345 and tcp xterm 2 (server side): [user@csslab2 hw3]$ hw3 12345 xterm 3 (client side): [user@csslab1 hw3]$ hw3 12345 csslab2
-l (message length) | -n (# messages) |
64 | 1048576 |
128 | 524288 |
256 | 262144 |
512 | 131072 |
1024 | 65536 |
2048 | 32768 |
4096 | 16384 |
8192 | 8192 |
16384 | 4096 |
-l (message length) | -n (# messages) |
32768 | 2048 |
-l (message length) | -n (# messages), round decimal points |
1458 | 67108864 / 1458 = 46028 |
1460 | 67108864 / 1460 = 45965 |
1462 | 67108864 / 1462 = 45902 |
-l (message length) | -n (# messages) |
64 | 1048576 |
Criteria | Percentage |
Test 1 execution: The hw3 tcpdump results as well as your program's tcpdump results. | 2pts(10%) |
Analysis 1: State transition diagram and timing chart that traces the hw3 program | 4pts(20%) |
Coding: Source code that adheres good modularization, coding style, and the appropriate amount of comments. The source code is graded in terms of (1) using shutdown, (2) correctness, and (3) coding guidelines. | 8pts(40%) |
Test 2 ~ 5's performance results: Include (1) test 2's results in Mbps, (2) test 3's results in terms of the advertised window, (3) test 4's results in Mbps, and (4) test 5's results in terms of packets sent, received, and retransmitted; and the time elapsed for each of the first 20 write system calls. Results must be compiled in tables and/or graphs. Don't attach raw data. | 3pts(15%) |
Discussions: Do all five analsysis. | 3pts(15%) |
Total | 20pts(100%) |