Project 4: A TCP State Transition ProgramVersion
1.0 Introduction The Transmission Control Protocol (TCP) is a protocol used on top of IP to help guarantee a reliable stream of data from the sender to the receiver. The purpose of this assignment is to get you familiar with how TCP works. A State Transition Diagram The figure below shows a state transition diagram for TCP. States are shown in boxes, and arrows show transitions. The appl: or recv: fields shows input received to cause the transition. The send: field shows output generated during the transition. Writing a Program Please write a program in C, C++, Ada, Python2, Python3, or Java to model the state transition diagram shown above. (If you want to choose a different programming language, you must approve it with me at least 5 days before the assignment is due so I can get it on the classs Linux servers.) For information on how to compile and run different programs on the Linux class servers, click here. First, begin your programs in the CLOSED state.
Here is an example run traversing the left side of the diagram with a spelling error and invalid state: Make your code output look exactly like the run above for full points! For clarification, use the following valid input strings:"passive open", "active open", "close", "SYN", "SYN,ACK", "ACK", "FIN". Print the states exactly as they are in the diagram (capital letters plus underscore). If any trasition is not visible in the diagram, just assume it is invalid. NOTE: The state TIME_WAIT takes no input. If you transition to this state, print it, and immediately move to closed (see example above). Testing your codeYou can test your code on the Linux server using input redirection and piping. First, read how the <, >, and | operators work using the following resources: Next, take a look at my sample testin.txt file. Notice it contains input to your program. Using the 'cat' program to read from your input file, run your program using the following command: $> cat testin.txt | ./stateTCP > out.txt (Note: You can replace './stateTCP' with your method of executing your program, like 'python3 stateTCP.py'.) Instead of printing to the screen, this will create an output file called 'out.txt'. To see if your output file exactly matches my output file, download my output file called testout.txt. You can compare the two files using the diff command: $> diff out.txt testout.txt If they are the same, diff will not display any output. For more information about the diff command, issue 'man diff'. I highly encourage you to write more test cases using input files that you create. I will be using a full suite of input and output files to test all paths of your program. Create a README.txt fileThe README.txt file should contain the following:
Turning it inYou will be turning in your README.txt file and your program code in two separate locations (no zip file this time.) Navigate to eLearning and click on the Project 4 folder. Submit your program file and README.txt file in the designated areas. Make sure your program is named stateTCP (with the appropriate extension), you have your name at the top of the program source, and you have at least three useful comments within your code. Note: This is your last programming project of the class. |