home  exhibition  quizzes  tour 
  basics  protocol mechanisms  internet  lans  applications  
state machine | connection management | ports | congestion control |

TCP State Machine

TCP Connection establishment and teardown can be represented in a finite state machine (FSM). Each connection starts in the CLOSED state. Transitions between states are triggered by some event (e.g. an incoming packet or a TCP user command) and eventually TCP takes some actions (e.g. sends a packet).

The application allows you to play with the TCP state machine located in two hosts and you can see how TCP connection management works between these hosts. It operates in two modes:

  • Demo: here you are able to choose between different possible connection establishment and teardown scenarios. If you press the start button, the selected scenario is animated.
  • Manual: in this case you are able to control the FSM by the user commands shown beside the two hosts. Additionally "duplicate SYN packets" can be sent over a button in the network cloud. Just try different cases (e.g. normal 3-way connection establishment, overlapping establishment) and see what happens. Are you able to walk through all transitions?
The state machine allows the following user commands:
  • Connect: Actively attempt to establish a connection
  • Listen: Wait for incoming connection requests
  • Close: This side wants to release the connection
Further, incoming and outgoing packets are named by the set TCP flags:
  • SYN: The SYN bit in the TCP header is set to 1 this indicates a connection establishment packet
  • ACK: the ACK bit is set to 1 and the packet carries a valid value in the acknowledgement field
  • FIN: a set FIN bit indicates a connection release packet.
  • RST: a packet with this bit set forces connection reset.
If you want to check first how the different procedures of TCP connection establishment and termination operate, try the TCP connection management application.


start the application