To keep track of all the different events happening during connection establishment, connection termination, and data transfer,
TCP is specified as the Finite State Machine –FSM
TCP State Machine:
* TCP uses a three way handshake to close connection
* Singled by the FIN bit in the packet header
The figure shows the two FSMs used by the TCP client and server combined in one diagram.
* Ovals/rectangle represents states.
* Transition from one state to another is shown using directed lines.
* Each line has two strings separated by a slash.
* The first string is the input, what TCP receives.
* The second is the output, what TCP sends.
* The dotted black lines in the figure represent the transition that a server normally goes through;
* The solid black lines show the transitions that a client normally goes through.
* Sometimes in some situations, a server transitions through a solid line or a client transitions through a dotted line.