TCP Connections
Initiated by a three-way handshake
1.5 RTTs create shared state on both side of connection
know first sequence number to be used know other side is ready to receive
Time Time
SYN ACK of SYN A C K
- f
S Y N S Y N
Connection-Oriented Demux
Host receives three TCP segments
all destined to IP address B, port 80 demuxed to different sockets through socket’ s 4-tuple
Application Transport Network Link Physical
80
P1 P2 Application Transport Network Link Physical
915
P4 Application Transport Network Link Physical
915
P5
Sources Destination Destination
B A C
915 80 A B Src Dst
64
B A 915 80 B C 517 80 B C 915
P3
517 80 C B Src Dst 915 80 C B Src Dst 517
P6
Typical TCP Usage
Three round trips to
set up a connection send a data packet receive a response tear down connection
FINs tear down connection
Can be piggybacked on Ack Time Time
SYN ACK of SYN A C K
- f
S Y N S Y N DATA D A T A A C K FIN, ACK A C K F I N A C K
Reliable Transport
TCP at sender keeps a copy of all sent, but unacknowledged, packets Packet resent if ACK does not arrive within a timeout Timeout interval adjusts to round-trip delay Time Time
DATA, seq# = 13, len = 2 ACK 15 DATA, seq# = 15, len = 3 DATA, seq# = 15, len = 3 ACK 18 Timeout AverageRTT = (1 - ) OldAverageRTT + LatestRTT AverageVar = (1 - ) OldAverageVar + LatestVar where LatestRTT = (ack_receive_time – send_time), LatestVar = |LatestRTT – AverageRTT|, = 1/8, = ¼ typically. Timeout = AverageRTT + 4 x AverageVar