1 CSc 361: Computer Communications and Networks
Assignment 2: TCP Traffic Analysis
6 1 Goal
7 The purpose of this project is to learn about the state management in Transmission Control Protocol
8 (TCP). You are required to write a python program to analyze the TCP protocol behavior.
9 2 Requirements
10 You will be given a TCP trace file (sample-capture-file in connex resource). During the period
11 traced, a single web client accesses web pages from different web sites on the Internet. This trace
12 is to be used to for your own test. Your code might be tested with another trace file, which will be
13 disclosed after your final submission.
14 You need to write a python program for parsing and processing the trace file, and tracking TCP
15 state information. In this assignment, you have the freedom to use any open-source Python module.
16 Your program should process the trace file and compute summary information about TCP
17 connections. Note that a TCP connection is identified by a 4-tuple (IP source address, source port,
18 IP destination address, destination port), and packets can flow in both directions on a connection
19 (i.e., duplex). Also note that the packets from different connections can be arbitrarily interleaved
20 with each other in time, so your program will need to extract packets and associate them with the
21 correct connection.
22 The summary information to be computed for each TCP connection includes:
23 • the state of the connection. Possible states are: S0F0 (no SYN and no FIN), S1F0 (one SYN
24 and no FIN), S2F0 (two SYN and no FIN), S1F1 (one SYN and one FIN), S2F1 (two SYN
25 and one FIN), S2F2 (two SYN and two FIN), S0F1 (no SYN and one FIN), S0F2 (no SYN and
26 two FIN), and so on, as well as R (connection reset due to protocol error). Getting this state
27 information correct is the most important part of your program. We are especially interested
28 in the complete TCP connections for which we see at least one SYN and at least one FIN.
29 For these complete connections, you can report additional information, as indicated in the
31 • the starting time, ending time, and duration of each complete connection
32 • the number of packets sent in each direction on each complete connection, as well as the total
34 • the number of data bytes sent in each direction on each complete connection, as well as
35 the total bytes. This byte count is for data bytes (i.e., excluding the TCP and IP protocol
37 Besides the above information for each TCP connection, your program needs to provide the
38 following statistical results for the whole trace data:
39 • the number of reset TCP connections observed in the trace
40 • the number of TCP connections that were still open when the trace capture ended
41 • the number of complete TCP connections observed in the trace
42 • Regarding the complete TCP connections you observed:
43 – the minimum, mean, and maximum time durations of the complete TCP connections
44 – the minimum, mean, and maximum RTT (Round Trip Time) values of the complete
45 TCP connections
46 – the minimum, mean, and maximum number of packets (both directions) sent on the
47 complete TCP connections
48 – the minimum, mean, and maximum receive window sizes (both sides) of the complete
49 TCP connections.
50 As a guideline for output format, please refer to the output format of this project (outputfor51 mat.pdf in connex resource).
52 3 Deliverables and Marking Scheme
53 For your final submission of your assignment, you are required to submit your source code to connex.
54 You should include a readme file to tell TA how to run your code. At the last lab session that you
55 attend, you need to demo your assignment to TAs. Nevertheless, before the final due date, you can
56 still make changes on your code and submit a change.txt file to connex to describe the changes after
57 your demo.
58 The marking scheme is as follows (refer to outputformat.pdf in connex resource as well):
Total number of connections 20
Connections’ details 30
General Statistics 20
Complete TCP connections: 20
Code style 5
Readme.txt and change.txt(if any) 5
Total Weight 100
60 4 Plagiarism
61 This assignment is to be done individually. You are encouraged to discuss the design of your solution
62 with your classmates, but each person must implement their own assignment.
63 The End