Professional Documents
Culture Documents
Kaagaz 20240408 131518065601
Kaagaz 20240408 131518065601
er
MODULE 5
1) What are the different services provided b_ the transportla er?
1. Process-to-Process Communication
D•••D
I
(
(
Processes
□ l
I
',
(
\
( 1
I I
• I
I I
I I
I I
I
I
!I rlll,111111! 11 ,111,po1 l•l,tllf' pl'ul"l \
\
ol
Page 1
1
CCN Module 5: Tran.porLlayer
Cliem Servl'f
Page2
2
CCN Module 5: Tran. port layer
l1i::-..1.t1011
/\ pphcatJon
I )"'
P2
ApplJce>Uon
l..1J r
l LOtl
mj•,1c-... J L
P1. l'roccss
Pus/Jing or Pulling
Delive1y of iten from a produ er to a con umer an occur in one of 1wo way : pushing
or pulling. If the. ender delivers items whene er they are produced withou1a prior request
from the consumer the delivery is referr d to a pushing. If the producer deli ers the items
after the consumer has reque ted them, the delivery is referred to as pulling. Figure 4
show the. e two types of delivery.
e --- O -----------
• Request :
8
Producer
L. Ddl\.:ty .
I
_P_m_d_u_c_r_-, -- -=----a► Cons mer
.
I
a. Pu hmg
Page3
3
CCN M dule 5: Transport
layer
A('>f>li<:alion
lay r
5. Error Control
In the Internet, since the underlying network layer (IP) i. unreliable, we need to make the
transport layer reliable if the application requires reliability. Reliability can be achie ed to
add rror ontrol . ervices to the tran. port lay r. Error control at the tra.n. p rt lay r is
re. pon. ibl for
1. Detecting and discarding corrupted packet
2. Keeping track of lost and di. carded packets and re. ending them.
3. Recognizing duplicate packets and di. carding them.
4. Buffering out-of-order packets until the mis ing packets arrive.
Page4
4
CCN Module 5: Tran.port
layer
Error control, u.nlike flo control, involves only L11e s nding and recei ing Lran. port
layers. Assume that the mes age chunks exchanged between the applicaLion and transport
layers are error free. Figure 6 hows the error control between the sending and receiving
transport layers. As with the case of flow control, Lhe receiving transport layer manage.
error control, most of the time. by infonning the sending Iran. port la er about the
problems.
Sender Receiver
ckc1.
the t.ran port-layer packet to hold the sequence number of the packet. When a pack t is
corrupted or lo L, the receiving transport layer can omehow inform Lhe sending tran. port
lay r to resend Lhat packet using th sequence number. The receiving transport layer can also
detect duplicate packet if two received packet. ha e lhe ame .equence number. The out-of
order packet. can be recognized by ob erving gap. in the equence numbers. Pa kets are
numbered equentiaJly. However, becau e we need to include the . equence number of each
packet in the header, we need to set a limit. If the header of the packet allows m bits for the
sequence number, the sequence numbers range from O to 2"' -1.
For example, if 111 is 4. the only sequence numbers are O through 15, inclusive. However. we
can wrap around the sequence. So the sequence numbers in this case are
. ender start a timer. If an ACK doe not arrive bef re the timer expire., the sender re end
Page5
5
CCN Module 5: Tran. port la
er
th packet. Duplicate packets can be silent] discarded b th receiver. Out-of-order packe1
can be either discarded (LO be treated lost packets by 1he sender), or s1ored until the missing
one arrives.
Page6
6
CCN Module 5: Tran.port
layer
3. Write outline and explain send window and receive window for Go back protocol/
selective repeat protocol.
Go-Back N protocol
To improve the efficiency of tran mi sion (IO fill the pipe), multiple packets m11st be
in tran ition \ hile the sender i waiting for acknowledgment. In other word , we need lO
let more than one packet be omstanding to keep the channel busy hile the sender is
v aiting for acknowledgment. One of the protocol i calJed Go-Back- (GBN). The key
to Go-back-N is lhat we can send several packets before receiving acknowledgments but
the receiver can only buffer one packet. We keep a copy or the ent pa ket u111il the
acknowledgments arrive. Ficure 9 . hows the outline of the protocol.
Packcl ACK
Application
, llccksum ackNo Lchcck um = Applic,tion
Tran port
Lo11icnl channels
• •• :_- _II I I • • ■ I I • • •
I I
end window Rccei,·c window
Send Window
The s nd window i an imaginary box covering the sequence numb r of Lh data
packets that can be in rran it or can be ent. In ea h window position, some of the sequence
numbers define the packets that ha e been sent; others define those that can be sent. The
maximum ize of the window is 2m - I, we let the size be fixed and set 10 the maximum value,
Figure JO how a sliding window of size 7 (m = 3) for the Go-Back- protocol.
First
\, outstanding ext
½ \ t send
ent.
ut tanding an be sent Cann 11 he
ack11owlcdgcd.
m1<l purged
(sent. but not when an:cptc<.I accepted
fmrn proccs from pron,s,
Page8
7
CCN M dule 5: Tran. port layer
The .end window at any Lime divide. Lhe possibles quence numbers into four region .
The first region, left of the window, defines the . equence number belonging to packets that
are already acknowledged. The sender doe. not worry about these packets and keep. no
copies of them. The second region, colored, define. lhe range of sequence numbers belonging
10 the packets that have been . ent, but have an unknown Latu.. The . ender need. t wait to
find om if these packets have been recei ed or were lost. These are called as outstwuling
packets. The third range. white in the figure, defines the range of equence numbers for
packets that can be sem; however, the corresponding data have not el been received from
lhe application layer. Finally, the fourth region, right of the window, define sequence
numbers that cannot be used until the window. lides.
r1r l Next
Ollbl:Ulding { ' loem!
: CI
I III .1..- --.-s----.--....,...-1----.-0---,-1-, --.1.-- _:_:1 U !_ :
2----.1_-
a. Window before sliding
:,o: J outstandingt • ,,
to
nd
o=6h arri ed. Thi mean that the recei er i waiting for pa k 1. with equence no 6.
Receive Window
The receive indow make . ure that the correct data packet are received a.nd that the
correct acknowledgment are . ent. ln Go-Back- , the size of the receive window is always I.
The receiver i. alway looking for the arrival of a. pecific packet. Any packet arriving out of
order is di. carded and needs to be resent. FigL1re 12 shows the receive window. It needs only
one variable, Rn (receive window, next packet expected), to define t.his abstraction. The
. equence numbers to the left of the, indow belong to the packet. already received and
acknowledged; the sequence numbers to the right of this windm define the packets that
cannot be received. Any received packet with a equence number in these two regions is
discarded. Only a packet with a sequence number matching the value of Rn is accepted and
Page9
8
CCN Module 5: Tran.port
layer
acknowl dged. The r cei e window al o. !ides, but onJy one slot at a Lim . When a correct
packet is received, the window slide., Rn= (Rn+ I) modulo 2m_
/? ext
t expected
••• : s> =: l==i=2==: =3==: 4 I 5 I--J--1--:--0-:--1--;-2·- : •• •
Alrc..:m.1)-' received I annot be
received
,md acknowkdg'-'d
I
FSM
Figure 13 . hows the FSM. for the GBN protocol.
Sender
The sender start in the ready state, but LhereaJter it can be in one of the two. tales:
ready or blocking. The t, o variables are normally initialized to O (Sf= Sn = 0).
► Ready late. Four events ma occur when the ender is in ready state.
a. If a request comes from tl1e application layer the ender creates a packet with the sequence
number . et 10 Sn. A opy of the pa ket i tored, and the pa ket i.. ent. The . ender aJso
. tart. the only timer if it is not running. The value of Sn i. now in remented, (Sn = Sn + 1)
modulo 2m. If the window i full, Sn = (Sf Ssize) modulo 2"', the sender goes 10 the
blocking late.
b. If an error-free ACK arri es with ack o related lo one of the out. landing packets,the
sender slides the window (set Sf = ac o), and if all out landing packets are
acknowledged (ack o = Sn), then the timer is topped. If aJI out. tanding packets are 1101
d. If a 1im -out occurs, the . ender resend. all out. tanding packet. and re. tart. Lhe timer.
Page 10
9
CCN Module 5: Transport layer
b. If an error-free pack t with seq o outside the window arriv s, the packet is discard d,
but an ACK, ilh ack o = Rn is .ent.
" m§i
"@I!IDi!
Timc-oi11:
rt',larl Y
Time Time
Page 12
10
CCN M dule 5: Transport
layer
marked (shaded lot), but i1 cannot be delivered b cause packe1 I 1s rrus. mg. At the next
arrival, packet 3 arri es and is marked and stored, but still none of the packeLScan be
delivered. Only at the last arrival, when finally a copy of packet l arrive., can packels I, 2,
and 3 be delivered 10 the application layer. There are two conditions for the delivery of packets
to the application layer: First, a set of consecutive packets mu. t have anived. Second, the set
. tarts from the beginning of the window. After the first ani aJ. there was only one packet and
it started from the beginning of the window. After the last arrival, there are three packets and
the first one tarts from the beginning of the window. The key is that a reliable transport layer
promises to deli er packe1s in order.
Window Sizes
We can now show why the ize of the . ender and receiver\ indow can be at mo. I
one-half of 2111. For an example, we choose m "' 2, which means the size of the window is 2"'/2
or 2(nrlJ= 2. Figure 23.36 compares a window size of 2 with a window size of 3. If the size of
the window is 2 and all acknowledgments are lost, the timer for packet 0 expires and packet 0
is r . ent. However, the window of the recei er i now exp cling packet 2, not pack t 0, so thi.
duplicate pa ket i correctly di carded (the equence number O i not in the window). When
the size of the window i. 3 and aJl acknowledgment are lo 1, the sender ends a duplicate of
packet 0. Hm ever, this time, the window of 1he receiver expects 10 recei e packet 0 (0 i part
of the window), so it accept packet 0, not a a duplicate, but a. a packet in the n xt cycle.
This is clearly an error.
4. What are the er ice provided b UDP'? Mention an four t. pical application of
DP.
Process-to-Process Communicalion
UDP provides process-Lo-proces. communication u. ing socket addresses, a combination of
IP addresses and port numbers.
Connectionless Services
UDP provides a connectionless service. This means that each user datagram selll by UDP is
an independent datagram. There is no relationship bet\ een the different user datagrams even
if they are coming from the . ame ource proce and going to the same de. tination program.
The user datagram are not numbered. Also, unlike TCP, there i no connection establi hment
a.nd no connection termination. This means that each user datagram can tra el on a differem
path. One of the ramifications of being connectionles is that the process that use UDP
cannot . end a lream of data to DP and expect DP to chop them into different, related user
Page20
11
CCN Module 5: Tran.port layer
datagrams. In. tead each requ . t mu t be small nough to fit imo one user datagram. Only
those proce. ses sending hort messages, mes ages le. s than 65,507 byte (65,535 minus 8
by1e for the UDP header and minu. 20 by1e. for the IP header), can use DP.
Flow Control
UDP is a very simple protocol. There i. no flow control. and hence no \ indm mechanism.
Th receiver may ov rflow with incoming messages. The lack of flo control mean that the
proces. u ing UDP. hould pro ide for thi. service. if needed.
Error Control
There is no error control mechanism in UDP except for th checksum. This means that the
. ender does not know if a m s ag ha. be n lo t or duplicated. When the recei er d te t an
error through the checksum, the u er datagram is . ilentJy di carded. The lack of error control
mean. that the proce. u. ing UDP should provide for this ..ervice, if needed.
Checksum
UDP check. um calcu.lation includes three seclions: a pseudoheader, the UDP header, and tJ1e
data coming from the application layer. The p eudoheader i the part of the header of the IP
packet in which the u. er datagram is to be encapsulated with some field filled with Os (see
Figure 20).
Page 21
12
CCN Module 5: Transport la
er
tran mis ion, the heck um ca.lculation at the re eiver will detect it and UDP drop Lhe packet.
It is not delivered lo the wrong protocol.
Congestion Control
Since UDP i. a connectionle. s protocol, it does not provide conge. tion control. UDP as umes
that the packets sent are small and sporadic and cannot create congestion in the network. This
as. umption may or may not be true today. when DP is used for interactive real-time transfer
of audio and ideo.
Queuing
In DP, queue. are a. sociated with ports. At the client ite, when a process start., it requests
a por1 number from the operating sy tem. Some implementations create both a..n incoming
and an outgoing queue. asso ia.ted with each process. Other implementations create onJy an
incoming queue associated with each process.
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 thal requires simple reques1-response communication with
little concern for flow and error comrol. It is not usuaJly u ed for a process such as FfP
that needs to send bulk data.
< DP i. suitable for a proces with internal flow- and error-control mechani, m. . For
e ample, the Tri ial File Transfer Protocol (TFfP) process includes flow and error control.
It can easily LL e UDP.
< DP i a. uitable Iran. port protocol for mullicasting. Mullicasting capability is embedded in
the DP software but not in the TCP sofh are.
Page 22
13
CCN M dule 5: Tran.port
layer
6. With a neat diagram explain TCP segment format
Segment
A pa ket in TCP is called a . egment.
Format
The format of a segment is shown in Figure 23.1. The segment consi I of a header of 20 to
60 b tes, follow d by data from Lhe applicaLion program. The header is 20 byt s if Lhere are
no options and up to 60 bytes if it contains options.
a. Ser;menl
)h
b. Hc:,der
< Acknowledgmenl number. Thi 32-bit field defines the byte number that the receiver of the
. egment i. expectin., to receive from the other party. If the receiv r of the . e..,rnent ha.
. ucce.. fully received byte number x from the 01her party, it returns x
as the
acknowledgment number. Acknowledgment and data an be piggyba ked together.
Page 27
14
CCN Module 5: Tran.port
layer
< Header length. This 4-bit field ind.icate Lhe number of 4-byt word in the TCP h ader. The
length of Lhe header can be between 20 and 60 bytes. Therefore, Lhe value of this field 1s
always between 5 C x 4 = 20) and •1 (15 x 4 =60).
< Control. This field defines 6 different control bits or flags, as shm n in Figure 24.8. One or
more of these b ts can be set al a time. These bits enable flow control, connection
establi hment and 1em1ination, connection abortion, and the mod of data tran fer in TCP.
A brief d cription of each bit i shown in the figur . 24
I i!.!1111· 2 . mrlmlfield
< Window ize. Thi.. field define the window ize of the ending TCP in byte.. Note that the
length of this field is 16 bits, which means that Lhe maximum ize of the , indow i 65,535
bytes. Thi value is normally referred to as the receiving windo, (rwnd) and i determined
by the receiver. The sender must obey the dictation of the receiver in this case.
<Checksum.This l 6-bil field contain the check um. The alculation of the checksum for
TCP follows the same procedure as the one described for DP. However, the use of the
checksum in the UDP datagram is optional, hereas Lhe u e of the checksum for TCP is
mandatory.
< rgent pointer. This 16-bit field, which is valid only if the urgent flag is set, is used when
the . egment r..:ontain urgent data. It define. a value that mu t be added 10 the. equence
number to obtain the number of the last urgent byte in the data section of the segment.
< Options. There can be up to 40 byte. of optional information in the TCP header.
Encapsulation
A TCP . egment encapsuJates Lhe data received from the applicat.ion layer. The TCP segment
is encap ulated in an IP datagram, which in tum is encap. ulated in a frame at the data-link
layer.
Page 28
15