tcp review
TRANSCRIPT
-
8/9/2019 TCP Review
1/18
TCP REVIEW
Slide content courtesy of Erich Nahum (IBM Research)
-
8/9/2019 TCP Review
2/18
THE TCP PROTOCOL
Connection-oriented, point-to-point protocol: Connection establishment and teardown phases
Phone-like circ!it abstraction "application-la#er $iew%
One sender& one recei$er
Called a 'reliable b#te stream( protocol
)eneral p!rpose "*or an# network en$ironment%
Originally optimized for certain kinds oftransfer:
Telnet "interacti$e remote lo+in%
,TP "lon+& slow trans*ers%
Web is like neither o* these
CPSC 641 IN!ER "#11 "
-
8/9/2019 TCP Review
3/18
TCP PROTOCOL "CO.T%
Provides a reliable, in-order, byte streamabstraction:
Reco$er lost packets and detect/drop d!plicates 0etect and drop corr!pted packets Preser$e order in b#te stream& no 'messa+e bo!ndaries( ,!ll-d!ple12 bi-directional data 3ow in same connection
Flow and congestion control: ,low control2 sender will not o$erwhelm recei$er Con+estion control2 sender will not o$erwhelm the network 4lidin+ window 3ow control 4end and recei$e b!5ers Con+estion control done $ia adapti$e 3ow control window si6e
CPSC 641 IN!ER "#11 $
soc%et
layer
!CP
send &uffer
a''lication
rites data
!CP
receie &uffer
soc%et
layer
a''lication
reads data
data se*ment
+C, se*ment
-
8/9/2019 TCP Review
4/18
THE TCP HE70ER
Fields enable thefollowing:
Uni!ely identifying each"CP connection
"8-t!ple2 client IP and port&
ser$er IP and port%#dentifying a byte range
within that connection
Checks!m val!e to detectcorr!ption
Flags to identify protocolstate transitions $%&',F#', (%")
#nforming other side ofyo!r state $*C+)
CPSC 641 IN!ER "#11 4
source port # dest port #
32 bits
applicationdata
(variable length)
sequence number
acknowledgement numberrcvr window size
ptr urgent datachecksum
FSR
!"headlen
notused
ptions (variable length)
-
8/9/2019 TCP Review
5/18
E4T79LI4HI.) 7 TCP CO..ECTIO.
Client sends %&' withinitial se!encen!mber $#%' )
%erver responds withits own %&' w.sen!mber & and *C+ ofclient #%' with /0$ne1t e1pected byte)
Client *C+s server2s #%'with &/0
"he 34-way handshake5
, & randomly chosen
*ll mod!lo 46-bitarithmetic
CPSC 641 IN!ER "#11 -
client
S.N(/)
server
S.N(.)0
+C,(/01
)
+C,(.01)
connect()listen()port $%
accept()
read()
time
-
8/9/2019 TCP Review
6/18
4E.0I.) 07T7
%ender "CP passes segments to #P totransmit:
:eeps a cop# in b!5er at send side in case o* loss
Called a 'reliable b#te stream( protocol
4ender m!st obe# recei$er ad$ertised window
(eceiver sends acknowledgments $*C+s)
7C:s can be pi++#backed on data +oin+ the other wa# Protocol allows recei$er to 7C: e$er#otherpacket in
attempt to red!ce 7C: tra;c "dela#ed 7C:s%
0ela# sho!ld not be more than "t#picall# ?== ms%
Well see how this ca!ses problems later
CPSC 641 IN!ER "#11 6
soc%et
layer
!CP
send &uffer
a''lication
rites data
!CP
receie &uffer
soc%et
layer
a''lication
reads data
data se*ment
+C, se*ment
-
8/9/2019 TCP Review
7/18
PREVE.TI.) CO.)E4TIO.
%ender may not only overr!n receiver, b!tmay also overr!n intermediate ro!ters:
.o wa# to e1plicitl# know ro!ter b!5er occ!panc#&
so we need to in*erit *rom packet losses 7ss!mption is that losses stem *rom con+estion& namel#&
that intermediate ro!ters ha$e no a$ailable b!5ers%ender maintains a congestionwindow: .e$er ha$e more than CW o* !n-acknowled+ed data
o!tstandin+ "or RWI. data@ min o* the two% 4!ccessi$e 7C:s *rom recei$er ca!se CW to +row>
7ow C8 grows based on which of 6 phases: 4low-start2 initial state> Con+estion a$oidance2 stead#-state> 4witch between the two when CW A slow-start threshold
CPSC 641 IN!ER "#11
-
8/9/2019 TCP Review
8/18
CO.)E4TIO. CO.TROL PRI.CIPLE4
9ack of congestion control wo!ld lead to congestioncollapse $acobson ;;)