Internet Engineering

advertisement
2
Y
State 3
P
1
1
M
3
3 X
A Q C Y X A - M Y X
Last Ack
Time Wait
Fin Wait 2
FSM of TCP connection machinery
Close Wait
Closing
Syn Sent
Fin Wait 1
Established
Listen
Closed
TCP Connections (States)
Syn Rcvd
1
What output actions are performed? 2
1
1 2 1 3 3 1 2 2 3 3 1
What states does FSM pass through?
1 2 3 2 3 1 3 1 2 3
For input events
State 1 is the initial state
Several output actions
Three events that occur 1 2 and 3
Three States 1 2 and 3
Inputs & Outputs to come later
Initial State
3
C
2
B 2 Q
State 2
1
A
State 1
FSM (example)
http://fivedots.coe.psu.ac.th/~kre
kre@coe.psu.ac.th
kre@munnari.OZ.AU
Robert Elz
241-461
Internet Engineering
Time Wait
Fin Wait 2
Last Ack
Close Wait
Not just Start at zero
To meet some objectives
No old packets from previous connection
Not easy for anyone to guess
Sender picks sequence number
Uses one sequence number itself
Always the first sequence number of this connection
SYN is a kind of data
Inform other end we want to communicate
Tell it what sequence number we use
Send SYNchronise
Last Ack
Close Wait
Syn Sent
TCP Opens
Neither system knows anything about other
Start in CLOSED state
SYN SYN+ACK ACK
Same 3-way handshake
Time Wait
Fin Wait 2
Established
Closing
ACK
Listen
(application request)
Closed
Fin Wait 1
Syn
SYN+
ACK
Rcvd SYN
TCP Server Open
3-way Handshake
SYN SYN+ACK ACK
Closing
Established
Syn Sent
Syn+Ack Received
Send ACK
Listen
Fin Wait 1
Syn Rcvd
(Application Request)
Send SYN
Closed
TCP Client Open
server
Syn Sent
Syn+Ack Received
Send ACK
(Application Request)
Timeout
Send SYN
Send SYN
SYN+ Timeout
ACK
ACK
Syn Rcvd
Listen
Established
Syn+Ack Received
Syn Sent
Send ACK
Send ACK SYN
SYN
SYN+
ACK
Send SYN
(Application Request)
(application request)
Timeout
Send SYN
Closed
At approximately the same time
Before either has seen SYN from the other
Both systems want to open connection
TCP Simultaneous Open
2 systems talking to each other
Both acting as clients
Investigate
Established
Closed
In each direction
But just ACK this time
SYN already sent
Other than retransmit
Just one SYN per connection
Must ACKnowledge that SYN
That is the SYN
Data in SYN+ACK packet must be acknowledged
TCP Opens (3)
Data here is SYN
Therefore SYN+ACK
Data and ACK can travel in same packet
Need sequence numbers both directions
So must SYNchronise in reverse
Send SYN back
to client
data goes both directions
TCP is full duplex
Must send ACKnowledge
So sender knows it was received
Receiver of SYN
So must be acknowledged
SYN is data
TCP Opens (2)
SYN
ACK
SYN + ACK
SYN+ACK+
SYN+ACK
SYN
ACK
SYN
ACK
ACK
SYN ++
ACK
ACK
ACK
SYN
Download