UDP and TCP header.ppt

nehayarrapothu 284 views 87 slides Jan 15, 2023
Slide 1
Slide 1 of 87
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87

About This Presentation

computer networks


Slide Content

24.1
24-1 INTRODUCTION
Afterdiscussingthegeneralprinciple
behindthetransportlayerinthe
previouschapter,weconcentrateonthe
transportprotocolsintheInternetinthis
chapter.

24.2
Fig 24.1: Position of transport-layer protocols in the TCP/IP protocol
suite

24.3
24.24.2 Port Numbers
Transport-layerprotocolusuallyhasseveralresponsibilities.
Oneistocreateaprocess-to-processcommunication;these
protocolsuseportnumberstoaccomplishthis.
Portnumbersprovideend-to-endaddressesatthetransport
layerandallowmultiplexinganddemultiplexingatthislayer,
justasIPaddressesdoatthenetworklayer.
Table24.1givessomecommonportnumbersforallthree
protocolsdiscussed.

Table 24.1: Some well-known ports used with UDP and TCP
24.4

24.5
24-2 UDP
TheUserDatagramProtocol(UDP)isaconnectionless,unreliable
transportprotocol.IfUDPissopowerless,whywouldaprocess
wanttouseit?Withthedisadvantagescomesomeadvantages.UDP
isaverysimpleprotocolusingaminimumofoverhead.
Ifaprocesswantstosendasmallmessageanddoesnotcaremuch
aboutreliability,itcanuseUDP.Sendingasmallmessageusing
UDPtakesmuchlessinteractionbetweenthesenderandreceiver
thanusingTCP.

24.6
24.2.1 User Datagram
UDPpackets,calleduserdatagrams,haveafixed-
sizeheaderof8bytesmadeoffourfields,eachof2
bytes(16bits).Figure24.2showstheformatofa
userdatagram.Thefirsttwofieldsdefinethesource
anddestinationportnumbers.Thethirdfield
definesthetotallengthoftheuserdatagram,header
plusdata.The16bitscandefineatotallengthof0
to65,535bytes.However,thetotallengthneedstobe
lessbecauseaUDPuserdatagramisstoredinanIP
datagramwiththetotallengthof65,535bytes.

•TheUserDatagramProtocol(UDP)isatransportlayerprotocol
definedforusewiththeIPnetworklayerprotocol.Itisdefined
byRFC768writtenbyJohnPostel.Itprovidesabest-effort
datagramservicetoanEndSystem(IPhost).
•TheserviceprovidedbyUDPisanunreliableservicethatprovides
noguaranteesfordeliveryandnoprotectionfromduplication.
•ThesimplicityofUDPreducestheoverheadfromusingthe
protocolandtheservicesmaybeadequate.
•UDPprovidesminimal,unreliable,besteffort,messagepassing
transporttoapplicationsandupperlayerprotocols.

Encapsulation and Layering
UDP message is encapsulated into an IP datagram.
IP datagram in turn is encapsulated into a physical
frame for actually delivery.
FALL 2005 CSI 4118 –UNIVERSITY OF OTTAWA

24.9
Figure 24.2: User datagram packet format

Introduction toUDP
UDPprovidesawayforapplicationstosendencapsulatedIPdatagramsand
sendthemwithouthavingtoestablishaconnection.
UDPtransmitssegmentsconsistingofan8-byteheaderfollowedbythe
payload.Thetwoportsservetoidentifytheendpointswithinthesourceand
destinationmachines.WhenaUDPpacketarrives,itspayloadishandedto
theprocessattachedtothedestinationport.
Thesourceportisprimarilyneededwhenareplymustbesentbacktothe
source.TheUDPlengthfieldincludesthe8-byteheaderandthedata.
The Internet protocol suite supports a connectionless transport protocol, UDP (User
Datagram Protocol).
The UDP header.

FlowControl
UDPisaverysimpleprotocol.Thereisnoflowcontrol,andhence
nowindowmechanism.Thereceivermayoverflowwithincoming
messages.UDPshouldprovideforthisservice,ifneeded.
ErrorControl
ThereisnoerrorcontrolmechanisminUDPexceptforthe
checksum.Thismeansthatthesenderdoesnotknowifamessage
hasbeenlostorduplicated.Whenthereceiverdetectsanerror
throughthechecksum,theuserdatagramissilentlydiscarded.
Checksum
UDPchecksumcalculationincludesthreesections:apseudo
header,theUDPheader,andthedatacomingfromtheapplication
layer.ThepseudoheaderisthepartoftheheaderoftheIPpacket
inwhichtheuserdatagramistobeencapsulatedwithsomefields
filledwith0s.

If the checksum does not include the pseudoheader, a user datagram may arrive safe
and sound. However, if the IP header is corrupted, it may be delivered to the wrong
host.
The protocol field is added to ensure that the packet belongs to UDP, and not to TCP.

Congestion Control
Since UDP is a connectionless protocol, it does not provide congestion control.
UDP
assumes that the packets sent are small and sporadic and cannot create
congestion in
the network.
Encapsulation and Decapsulation
To send a message from one process to another, the UDP protocol
encapsulates and
decapsulates messages.
Queuing
In UDP, queues are associated with ports. At the client site, when a process
starts, it requests a port number from the operating system.
Some implementations create both an incoming and an outgoing queue
associated with each process.Other implementations create only an incoming
queue associated with each process.
Multiplexing and Demultiplexing
In a host running a TCP/IP protocol suite, there is only one UDP but possibly
several processes that may want to use the services of UDP. To handle this

24.14
24.2.3 UDP Applications
AlthoughUDPmeetsalmostnoneofthecriteriawementionedearlierfor
areliabletransport-layerprotocol,UDPispreferableforsome
applications.
Thereasonisthatsomeservicesmayhavesomesideeffectsthatare
eitherunacceptableornotpreferable.Anapplicationdesignersometimes
needstocompromisetogettheoptimum.
Forexample,inourdailylife,weallknowthataone-daydeliveryofa
packagebyacarrierismoreexpensivethanathree-daydelivery.
Althoughhighspeedandlowcostarebothdesirablefeaturesindelivery
ofaparcel,theyareinconflictwitheachother.

24.15
UDP Features
Some of the features of UDP and their advantages and disadvantages.
Connectionless Service
As we mentioned previously, UDP is a connectionless protocol. Each UDP packet is
independent from other packets sent by the same application program.
Lack of Error Control
UDP does not provide error control; it provides an unreliable service. Most applications
expect reliable service from a transport-layer protocol.
Lack of Congestion Control
UDP does not provide congestion control. However, UDP does not create additional
traffic in an error-prone network. TCP may resend a packet several times and thus
contribute to the creation of congestion or worsen a congested situation.

24.16
Typical Applications
The following shows some typical applications that can benefit more from the services of
UDP than from those of TCP.
UDP is suitable for a process that requires simple request-response communication with
little concern for flow and error control. It is not usually used for a process such as FTP
that needs to send bulk data.
UDP is suitable for a process with internal flow-and error-control mechanisms. For
example, the Trivial File Transfer Protocol (TFTP) process includes flow and error control.
UDP is a suitable transport protocol for multicasting. Multicasting capability is
embedded in the UDP software but not in the TCP software.
UDP is used for management processes such as SNMP.
Used for some route updating protocols such as Routing Information Protocol (RIP).
UDP is normally used for interactive real-time applications that cannot tolerate uneven
delay between sections of a received message.

24.17
TRANSMISSIONCONTROLPROTOCOL
TransmissionControlProtocol(TCP)isaconnection-oriented,reliable
protocol.TCPexplicitlydefinesconnectionestablishment,datatransfer,and
connectionteardownphasestoprovideaconnection-orientedservice.
TCPusesacombinationofGBNandSRprotocolstoprovidereliability.To
achievethisgoal,TCPuseschecksum(forerrordetection),retransmissionoflost
orcorruptedpackets,cumulativeandselectiveacknowledgments,andtimers.
TCPServices
TheservicesofferedbyTCPtotheprocessesattheapplicationlayer.
Process-to-ProcessCommunication
AswithUDP,TCPprovidesprocess-to-processcommunicationusingportnumbers.
StreamDeliveryService
TCP,unlikeUDP,isastream-orientedprotocol.InUDP,aprocesssendsmessageswith
predefinedboundariestoUDPfordelivery.UDPaddsitsownheadertoeachofthese
messagesanddeliversittoIPfortransmission.Eachmessagefromtheprocessiscalled
auserdatagram,andbecomes,eventually,oneIPdatagram.NeitherIPnorUDP
recognizesanyrelationshipbetweenthedatagrams.

Streamdelivery
Sending
process
Receiving
process
Stream ofbytes
24.18
TCP,ontheotherhand,allowsthesendingprocesstodeliverdataasastream
ofbytesandallowsthereceivingprocesstoobtaindataasastreamofbytes.
TCPcreatesanenvironmentinwhichthetwoprocessesseemtobeconnected
byanimaginary“tube”thatcarriestheirbytesacrosstheInternet.This
imaginaryenvironmentisdepictedinFigure.Thesendingprocessproduces
(writesto)thestreamandthereceivingprocessconsumes(readsfrom)it.

Sending and receivingbuffers
Stream ofbytes
Sending process
24.19
Receiving
process
Atthesender,thebufferhasthreetypesofchambers.Thewhitesectioncontainsempty
chambersthatcanbefilledbythesendingprocess(producer).Thecoloredareaholdsbytes
thathavebeensentbutnotyetacknowledged.TheTCPsenderkeepsthesebytesinthe
bufferuntilitreceivesanacknowledgment.Theshadedareacontainsbytestobesentbythe
sendingTCP.
Theoperationofthebufferatthereceiverissimpler.Thecircularbufferisdividedintotwoareas
(shownaswhiteandcolored).Thewhiteareacontainsemptychamberstobefilledbybytesreceived
fromthenetwork.Thecoloredsectionscontainreceivedbytesthatcanbereadbythereceiving
process.

TCPsegments
24.20
Atthetransportlayer,TCPgroupsanumberofbytestogetherintoapacket
calledasegment.TCPaddsaheadertoeachsegment(forcontrolpurposes)and
deliversthesegmenttothenetworklayerfortransmission.
ThesegmentsareencapsulatedinanIPdatagramandtransmitted.Notethat
segmentsarenotnecessarilyallthesamesize.Inthefigure,onesegmentcarries
3bytesandtheotheriscarrying5bytes.

24.21
Full-Duplex Communication
TCP offers full-duplex service, where data can flow in both directions at the same
time. Each TCP endpoint then has its own sending and receiving buffer, and
segments move in both directions.
Multiplexing and Demultiplexing
Like UDP, TCP performs multiplexing at the sender and demultiplexing at the
receiver. However, since TCP is a connection-oriented protocol, a connection
needs to be established for each pair of processes.
Connection-Oriented Service
TCP, unlike UDP, is a connection-oriented protocol. When a process at site A
wants to send to and receive data from another process at site B, the following
three phases occur:
1. The two TCP’s establish a logical connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.
Reliable Service
TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check
the safe and sound arrival of data.

24.22
TCPFeatures
Toprovidetheservicesmentionedintheprevioussection,TCPhasseveralfeatures
NumberingSystem
AlthoughtheTCPsoftwarekeepstrackofthesegmentsbeingtransmittedorreceived,there
isnofieldforasegmentnumbervalueinthesegmentheader.Instead,therearetwofields,
calledthesequencenumberandtheacknowledgmentnumber.
ByteNumber
TCPnumbersalldatabytes(octets)thataretransmittedinaconnection.Numberingis
independentineachdirection.Thenumberingdoesnotnecessarilystartfrom0.Instead,TCP
choosesanarbitrarynumberbetween0and2
32
−1forthenumberofthefirstbyte.For
example,ifthenumberhappenstobe1057andthetotaldatatobesentis6000bytes,the
bytesarenumberedfrom1057to7056.
SequenceNumber
Afterthebyteshavebeennumbered,TCPassignsasequencenumbertoeachsegmentthatis
beingsent.Thesequencenumber,ineachdirection,isdefinedasfollows:
1.ThesequencenumberofthefirstsegmentistheISN(initialsequencenumber),whichisa
randomnumber.
2.Thesequencenumberofanyothersegmentisthenumberoftheprevioussegmentplus
thenumberofbytes(realorimaginary)carriedbytheprevioussegment.
AcknowledgmentNumber
Thevalueoftheacknowledgmentfieldinasegmentdefinesthenumberofthenextbyte
apartyexpectstoreceive.Theacknowledgmentnumberiscumulative.

•EverybyteonaTCPconnectionhasitsown32-bitsequence
number.
•ThesendingandreceivingTCPentitiesexchangedatainthe
formofsegments.ATCPsegmentconsistsofafixed20-byte
header(plusanoptionalpart)followedbyzeroormoredata
bytes.TheTCPsoftwaredecideshowbigsegmentsshouldbe.
•Twolimitsrestrictthesegmentsize.First,eachsegment,
includingtheTCPheader,mustfitinthe65,515-byteIP
payload.Second,eachnetworkhasamaximumtransferunit,
orMTU,andeachsegmentmustfitintheMTU
The TCPProtocol

TCPsegmentformat

•TheSourceportandDestinationportfieldsidentifythelocalendpointsofthe
connection.Aportplusitshost'sIPaddressformsa48-bituniqueendpoint.
Thesourceanddestinationendpointstogetheridentifytheconnection.
•Thisconnectionidentifieriscalleda5tuplebecauseitconsistsoffivepieces
ofinformation:theprotocol(TCP),source,IPandsourceport,anddestination
IPanddestinationport.
•TheSequencenumberandAcknowledgementnumberfieldsperformtheir
usualfunctions.Thelatterspecifiesthenextbyteexpected,notthelastbyte
correctlyreceived.Bothare32bitslongbecauseeverybyteofdatais
numberedinaTCPstream.
•TheTCPheaderlengthtellshowmany32-bitwordsarecontainedintheTCP
header.
•Nextcomesa6-bitfieldthatisnotused.

•CWRandECEareusedtosignalcongestionwhenECN(Explicit
CongestionNotification)isused.ECEissettosignalanECN-
EchotoaTCPsendertotellittoslowdownwhentheTCPreceiver
getsacongestionindicationfromthenetwork.CWRissettosignal
CongestionWindowReducedfromtheTCPsendertotheTCP
receiversothatitknowsthesenderhassloweddownandcanstop
sendingtheECN-Echo.
•URGissetto1iftheUrgentpointerisinuse.TheUrgentpointeris
usedtoindicateabyteoffsetfromthecurrentsequencenumberat
whichurgentdataaretobefound.
•TheACKbitissetto1toindicatethattheAcknowledgement
numberisvalid.

•ThePSHbitindicatesPUSHeddata.Thereceiverisherebykindly
requestedtodeliverthedatatotheapplicationuponarrivalandnot
bufferituntilafullbufferhasbeenreceived.
•TheRSTbitisusedtoabruptlyresetaconnectionthathasbecome
confusedduetoahostcrashorsomeotherreason.
•TheSYNbitisusedtoestablishconnections.Theconnection
requesthasSYN=1andACK=0.Theconnectionreplydoesbear
anacknowledgement,however,soithasSYN=1andACK=1.
•TheFINbitisusedtoreleaseaconnection.Itspecifiesthatthe
senderhasnomoredatatotransmit.

•FlowcontrolinTCPishandledusingavariable-sizedslidingwindow.The
Windowsizefieldtellshowmanybytesmaybesentstartingatthebyte
acknowledged.
•AChecksumisalsoprovidedforextrareliability.Itchecksumstheheader,
thedata,andaconceptualpseudoheaderinexactlythesamewayasUDP.
•TheOptionsfieldprovidesawaytoaddextrafacilitiesnotcoveredbythe
regularheader.Manyoptionshavebeendefinedandseveralarecommonly
used.
–AwidelyusedoptionistheonethatallowseachhosttospecifytheMSS
(MaximumSegmentSize)itiswillingtoaccept.
–Thetimestampoptioncarriesatimestampsentbythesenderand
echoedbythereceiver.
–TheSACK(SelectiveACKnowledgement)optionletsareceivertella
sendertherangesofsequencenumbersthatithasreceived

The TCP SegmentHeader
The pseudoheader included in the TCP
checksum.

24.30
24.3.4 A TCP Connection
TCPisconnection-oriented.Allofthesegmentsbelongingtoamessage
arethensentoverthislogicalpath.
Usingasinglelogicalpathwayfortheentiremessagefacilitatesthe
acknowledgmentprocessaswellasretransmissionofdamagedorlost
frames.
TCP,whichusestheservicesofIP,aconnectionlessprotocol,canbe
connection-oriented.ThepointisthataTCPconnectionislogical,not
physical.
TCPusestheservicesofIPtodeliverindividualsegmentstothereceiver,
butitcontrolstheconnectionitself.

ConnectionEstablishment
TCPtransmitsdatainfull-duplexmode.WhentwoTCPsintwomachinesare
connected,theyareabletosendsegmentstoeachothersimultaneously.
Three-WayHandshaking
TheconnectionestablishmentinTCPiscalledthree-wayhandshaking.Inour
example,anapplicationprogram,calledtheclient,wantstomakeaconnectionwith
anotherapplicationprogram,calledtheserver,usingTCPasthetransport-layer
protocol.
Theprocessstartswiththeserver.TheserverprogramtellsitsTCPthatitisreadyto
acceptaconnection.Thisrequestiscalledapassiveopen.AlthoughtheserverTCP
isreadytoacceptaconnectionfromanymachineintheworld,itcannotmakethe
connectionitself.
Theclientprogramissuesarequestforanactiveopen.Aclientthatwishestoconnect
toanopenservertellsitsTCPtoconnecttoaparticularserver.

24.32
Figure 24.10: Connection establishment using three-way handshaking
•Step1(SYN):Inthefirststep,clientwantsto
establishaconnectionwithserver,soitsendsa
segmentwithSYN(SynchronizeSequence
Number)whichinformsserverthatclientis
likelytostartcommunicationandwithwhat
sequencenumberitstartssegmentswith
•Step2(SYN+ACK):Serverrespondstothe
clientrequestwithSYN-ACKsignalbitsset.
Acknowledgement(ACK)signifiestheresponse
ofsegmentitreceivedandSYNsignifieswith
whatsequencenumberitislikelytostartthe
segmentswith
•Step3(ACK):Inthefinalpartclient
acknowledgestheresponseofserverandthey
bothestablishareliableconnectionwithwhich
theywillstarttheactualdatatransfer

SYN Attack
•Attacker A initiates a SYN flooding
by generating many requests with
SPOOFED source address.
•Thus forces ‘D’ to allocate resources.
•With many such requests destination
host can run out of resources.
•……DOS…….DOS…..DOS….

24.34
Figure 24.11: Data transfer

Pushing Data
The sending TCP uses a buffer to store the stream of data coming from the sending application program.
However, there are occasions in which the application program has no need for this flexibility. The
application program on one site wants to send a chunk of data to the application program at the other site
and receive an immediate response.
Delayed transmission and delayed delivery of data may not be acceptable by the application program.
TCP can handle such a situation. The application program at the sender can request a push operation.
This means that the sending TCP must not wait for the window to be filled. It must create a segment and
send it immediately
Urgent Data
TCP is a stream-oriented protocol. This means that the data is presented from the application program to
TCP as a stream of bytes. Each byte of data has a position in the stream. However, there are occasions in
which an application program needs to send urgent bytes, some bytes that need to be treated in a special
way by the application at the other end. The solution is to send a segment with the URG bit set.

24.36
Figure 24.12: Connection termination using three-way handshaking

Three-Way Handshaking for connection termination.
Most implementations today allow three-way handshaking for connection termination,
1.TheclientTCP,afterreceivingaclosecommandfromtheclientprocess,sendsthefirst
segment,aFINsegmentinwhichtheFINflagisset.Ifitisonlyacontrolsegment,it
consumesonlyonesequencenumberbecauseitneedstobeacknowledged.
2.TheserverTCP,afterreceivingtheFINsegment,informsitsprocessofthesituation
andsendsthesecondsegment,aFIN+ACKsegment,toconfirmthereceiptoftheFIN
segmentfromtheclientandatthesametimetoannouncetheclosingoftheconnection
intheotherdirection.Ifitdoesnotcarrydata,itconsumesonlyonesequencenumber
becauseitneedstobeacknowledged.
3.TheclientTCPsendsthelastsegment,anACKsegment,toconfirmthereceiptofthe
FINsegmentfromtheTCPserver.Thissegmentcontainstheacknowledgmentnumber,
whichisoneplusthesequencenumberreceivedintheFINsegmentfromtheserver.
Thissegmentcannotcarrydataandconsumesnosequencenumbers.

24.38
Figure 24.13: Half-close

Half-Close
InTCP,oneendcanstopsendingdatawhilestillreceivingdata.Thisiscalledahalfclose.
Eithertheserverortheclientcanissueahalf-closerequest.Itcanoccurwhentheserver
needsallthedatabeforeprocessingcanbegin.
Thismeanstheclient,aftersendingalldata,canclosetheconnectionintheclient-to-
serverdirection.
However,theserver-to-clientdirectionmustremainopentoreturnthedata.
Thedatatransferfromtheclienttotheserverstops.Theclienthalf-closestheconnection
bysendingaFINsegment.Theserveracceptsthehalf-closebysendingtheACKsegment.
Theserver,however,canstillsenddata.
Whentheserverhassentalloftheprocesseddata,itsendsaFINsegment,whichis
acknowledgedbyanACKfromtheclient.
Afterhalf-closingtheconnection,datacantravelfromtheservertotheclientand
acknowledgmentscantravelfromtheclienttotheserver.Theclientcannotsendanymore
datatotheserver.
Connection Reset
TCP at one end may deny a connection request, may abort an existing connection, or may
terminate an idle connection. All of these are done with the RST (reset) flag.

24.40
24.3.6 Windows in TCP
TCPusestwowindows(sendwindowandreceivewindow)
foreachdirectionofdatatransfer,whichmeansfour
windowsforabidirectionalcommunication.
Tomakethediscussionsimple,wemakeanunrealistic
assumptionthatcommunicationisonlyunidirectional.The
bidirectionalcommunicationcanbeinferredusingtwo
unidirectionalcommunicationswithpiggybacking.

24.41
Figure 24.17: Send window in TCP

24.42
Figure 24.18: Receive window in TCP

23.43
Whatisthevalueofthereceiverwindow(rwnd)forhost
Aifthereceiver,hostB,hasabuffersizeof5000bytes
and1000bytesofreceivedandunprocesseddata?
Example
Solution
Thevalueofrwnd=5000−1000=4000.HostBcan
receiveonly4000bytesofdatabeforeoverflowingits
buffer.HostBadvertisesthisvalueinitsnextsegmentto
A.

24.44
24.3.7 Flow Control
Asdiscussedbefore,flowcontrolbalancestheratea
producercreatesdatawiththerateaconsumercan
usethedata.TCPseparatesflowcontrolfromerror
control.Inthissectionwediscussflowcontrol,
ignoringerrorcontrol.Weassumethatthelogical
channelbetweenthesendingandreceivingTCPis
error-free.

24.45
Figure 24.19: Data flow and flow control feedbacks in TCP

24.46
Figure 24.20: An example of flow control

24.47
24.3.8 Error Control
TCPisareliabletransport-layerprotocol.This
meansthatanapplicationprogramthatdeliversa
streamofdatatoTCPreliesonTCPtodeliverthe
entirestreamtotheapplicationprogramonthe
otherendinorder,withouterror,andwithoutany
partlostorduplicated.

24.48
Figure 24.24: Normal operation

24.49
Figure 24.25: Lost segment

24.50
Figure 24.26: Fast retransmission

24.51
Figure 24.27: Lost acknowledgment

24.52
Figure 24.28: Lost acknowledgment corrected by resending a segment

24.53
24.3.9 TCP Congestion Control
TCPusesdifferentpoliciestohandlethecongestion
inthenetwork.Wedescribethesepoliciesinthis
section.

24.54
Figure 24.29: Slow start, exponential increase

24.55
Figure 24.30: Congestion avoidance, additive increase

24.56
Figure 24.31: FSM for Taho TCP

24.57
Figure 24.35: Additive increase, multiplicative decrease (AIMD)

Retransmission Timer Management
24.58
static timer likely too long or too short
estimate round trip delay by observing pattern of delay for
recent segments
set time to value a bit greater than estimate
simple average over a number of segments
exponential average using time series (RFC793)
RTT Variance Estimation (Jacobson’s algorithm)

Retransmission Timer
24.59
Simple Average
RTT(i): round-trip time observed for the i
th
transmitted segment
ARTT(K): average round-trip time for the first
Ksegments



1
1
)(
1
1
)1(
K
i
iRTT
K
KARTT )1(
1
1
)(
1
)1( 



 KRTT
K
KARTT
K
K
KARTT

Retransmission Timer
24.60
Exponential Average
SRTT: smoothed round-trip time estimate
RTO: retransmission timer)1()1()()1(  KRTTKSRTTKSRTT   )1()1( KSRTTKRTO

RTT Variance Estimation
24.61
AERR(K): sample mean deviation measured at time K)()1()1( KARTTKRTTKAERR  )1(
1
1
)(
1
)(
1
1
)1(
1
1






 


KAERR
K
KADEV
K
K
iAERR
K
KADEV
K
i

RTT Variance Estimation
24.62
Jacobson’s Algorithm)1()()1()1(  KRTTgKSRTTgKSRTT )()1()1( KSRTTKRTTKSERR  )1()()1()1(  KSERRhKSDEVhKSDEV )1()1()1(  KSDEVfKSRTTKRTO
g = 1/8 = 0.125, h = ¼ = 0.25, f = 2

Jacobson’s RTO
24.63
Smoothed RTT
RTT Deviation
RTO

Exponential RTO Backoff
24.64
timeout probably due to congestion
dropped packet or long round trip time
hence maintaining RTO is not good idea
better to increase RTO each time a segment is re-transmitted
RTO = q*RTO
commonly q=2 (binary exponential backoff)
as in ethernetCSMA/CD

Karn’sAlgorithm
24.65
if segment is re-transmitted, ACK may be for:
first copy of the segment (longer RTT than expected)
second copy
no way to tell
don’t measure RTT for re-transmitted segments
calculate backoffwhen re-transmission occurs
use backoffRTO until ACK arrives for segment that has not
been re-transmitted

24.66
24-4 SCTP
StreamControlTransmissionProtocol
(SCTP)isanewtransport-layerprotocol
designedtocombinesomefeaturesof
UDPandTCPinanefforttocreatea
protocolformultimediacommunication.

24.67
24.4.1 SCTP Services
BeforediscussingtheoperationofSCTP,letus
explaintheservicesofferedbySCTPtothe
application-layerprocesses.

24.68
Figure 24.38 : Multiple-stream concept

24.69
Figure 24.39 : Multihoming concept

24.70
24.4.2 SCTP Features
ThefollowingshowsthegeneralfeaturesofSCTP.
Transmission Sequence
Number (TSN)
Stream Identifier (SI)
Stream Sequence Number
(SSN)

24.71
Figure 24.40 : Comparison between a TCP segment and an SCTP
packet

24.72
Figure 24.41 : Packets, data chunks, and streams

24.73
24.4.3 Packet Format
AnSCTPpackethasamandatorygeneralheader
andasetofblockscalledchunks.Therearetwo
typesofchunks:controlchunksanddatachunks.A
controlchunkcontrolsandmaintainsthe
association;adatachunkcarriesuserdata.Ina
packet,thecontrolchunkscomebeforethedata
chunks.Figure24.42showsthegeneralformatof
anSCTPpacket.

24.74
Figure 24.43 : SCTP packet format

24.75
Figure 8.50 : General header

24.76
Figure 24.44 : Common layout of a chunk

Table 24.3: Chunks
24.77

24.78
24.4.4 An SCTP Association
SCTP,likeTCP,isaconnection-orientedprotocol.
However,aconnectioninSCTPiscalledan
associationtoemphasizemultihoming.

24.79
Figure 24.45: Four-way handshaking

24.80
Figure 24.46 : Association termination

24.81
24.4.5 Flow Control
FlowcontrolinSCTPissimilartothatinTCP.In
SCTP,weneedtohandletwounitsofdata,thebyte
andthechunk.Thevaluesofrwndandcwndare
expressedinbytes;thevaluesofTSNand
acknowledgmentsareexpressedinchunks.Toshow
theconcept,wemakesomeunrealisticassumptions.
Weassumethatthereisnevercongestioninthe
networkandthatthenetworkiserrorfree.

24.82
Figure 24.47: Flow control, receiver site

24.83
Figure 24.48: Flow control, sender site

24.84
24.4.6 Error Control
SCTP,likeTCP,isareliabletransport-layer
protocol.ItusesaSACKchunktoreportthestateof
thereceiverbuffertothesender.Each
implementationusesadifferentsetofentitiesand
timersforthereceiverandsendersites.Weusea
verysimpledesigntoconveytheconcepttothe
reader.

24.85
Figure 24.49 : Error control, receiver site

24.86
Figure 24.50 : Error control, sender site

24.87
Figure 24.51: New state at the sender site after receiving a SACK chunk
Tags