Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

CCN Module 5: Transport la

er

MODULE 5
1) What are the different services provided b_ the transportla er?

1. Process-to-Process Communication

The fir L dut of a tran. port-layer protocol i. to provide process-to-process


communication. proce . i an applicalion-layer ntity (running program) that u e. th
ervic of the Lransport layer. The network layer i. respon. ible for communicalion at the
computer level (ho 1-10-ho. t communication). A network-layer protocol can deliver the
me sage only to the de. tination computer. However, this is an incomplete delivery. The
message still needs to be handed 10 the correct process. This is where a transport-layer
protocol takes over. transport-layer protocol i responsible for deJjvery of the message
to the appropriate process. Figure shows the domains of a network layer and a transport
layer.

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

Figure I: etwork layer versus transport layer


2. Encapsulation and Decapsulation
To .end a mes age from one proce.. 10 another, the transport-layer protocol
encapsulate and decap. uJat . mes. age. (Figure 2). Encap ulation happens at the ender
. ite. When a proce . ha. a me.. age to end, it pa e. the me age 10 the transport layer
along with a pair of. ocket addresse and some other pieces of information, which depend
on the transport-layer protocol. The transport layer receives the data and adds the
transport-layer header. The packets al the transport layer in the Internet are called
user dawgrarm, .wxments, or packets, depending on what transport-layer protocol \ e
use. In general.transport-layer pa loads are called as packets.
Decap ulaLion happens a1 lhe recei er si1e. When Lhe message arri es at the
de. tination tran. port layer, the header i. dr pped and the tran. port layer delivers the

Page 1

1
CCN Module 5: Tran.porLlayer

me . ag 10 the proce s running at the application layer. Th ender. ocket addre


passed to the process in ca e it needs to respond to the message received.

Cliem Servl'f

Application Process D Process 0 Application


la)Cf layer

Transport Logical channel Transport


layer Header layer
a. Encapsulation b. Decapsulation

Figure 2: Encapsulation and decap. ulation

3. MuJtiplexing and Demultiplexing


Whenever an entity accepts items from more than one source, this is referred to a.
multiplexing (man to one): whene er an enLity delivers item. 10 more than one ource.
thi. i referred 10 as demultiplexing (one to many). The tran port layer at Lhe source
performs multiplexing; the transport la er at the de tination perform demultiplexing
Figure 3 how. communication between a client and two . ervers. Three client
proce ses are running at the client site P1, P2, and P3. The processes PI and P3 need to
send requests to the corresponding erver proces running in a server. The client process
P2 n ed. to nd a requ t to th corre. ponding . rver pr ss running at anoth r s r er.
The transport layer at the client ite accept three me age from the three proce. es and
create. three packet . It act a! a multiplexer. The packet. 1 and 3 u e the . ame IogicaJ
channel to reach the transport layer of the first . erver. When they arrive at the er er, the
transport layer does the job of a demultiplexer and distributes the messages to two
different processe.. The transport layer at the second server receive. packet 2 and delivers
it to the corresponding proce.. . ote that we still ha e demultiplexing although there i.
only one message.

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

Figure 3: Mu!Liplexing and demuJLiplexing


4. Flow Control
Whenever an entity produce items and anolher entity consume them, I.here should
be a balance between production and consumption rates. If the items are produced fa ter
than they can be consumed, the consumer can be o erwhelmed and may need to discard
some items. If the item are produced more . lowly than they can be consumed, the
consum r mu t wait, and the system become Jes efficient. Rm contrnl is related to the
first i ue. We ne d to prevent lo ing Lhe data item. at Lhe consumer ite.

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

Figure 4: Pushing or pulling

Page3

3
CCN M dule 5: Transport
layer

Flow Control at Transport Lnyer


In communication at the transport layer, , e are dealing wilh four entities: sender
proces , sender transport layer. receiver tran. port layer. and recei er proce . The sending
proces at the application layer is only a producer. It produce me age chunks and pu hes
them to the transport layer.
The sending transport layer has a double role: II i both a consumer and a producer. It
consumes the messages pushed by the producer. II encapsulates the messages in packets and
pushes them 10 the receiving tran port layer. The rec i ing transport layer also has a double
role: it is the consumer for the packet recei ed from the ender and the producer that
decapsulate. the me. sage and deliver. them 10 the application layer. The la I delivery,
however, i normally a pulling delivery; the Iran port layer wail until the application-layer
process asks for messages.
Figure 5 . hows that we need al least two cases of flow control: from the sendjng
tran port layer to the sending application layer and from the receiving Iran port layer to the
. ending transport layer.

A('>f>li<:alion
lay r

ks.al'"' k·, agc,


cm,pushed arc pulled
..--...-+--.
Tniri,pun
Tr.:m r>ort
layer
la)·cr

Figure 5: Flow control at the tran port layer

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.

Figure 6: Err r control at the tran port layer


Sequence Numbers
Error control requires ilial ilie . ending Lranspo11 layer knm s which packet is lo be
resent and Lhe receiving transport la er know which packet i a duplicate. or which packet
ha arri ed out of order. This can be done if the packet are numbered. We can add a field 10

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

0. l, 2. . . . 7. 8, 9'. 10. I 1. 12,I13, I-', 15, 0. I, . J. ..ii. 5. 6, , . 9. LO. l l, ...


In olher ord., Lhe sequence numbers are modulo 2m.
Acknowledgment
The receiver side can send an acknowledgmenL (ACK) for ach of a collection of
packet that ha e ani ed afe and sound. The receiver can simpl discard the corrupted
packets. Th sender can d tect lost pa ket if it uses a timer. Wh n a packet is sent, the

. 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.

6. Conge tion Control


Congestion in a network may occur if the load on the network-the number of packets
sent 10 Lh n t\ ork is greater than Lh capacity of the network, the numb r of packet a
net ork can handle. Cong . tion control refers to the mechani. m and technique that control
the conge. tion and keep the load helm the capacity.
ongestion happen in any ystem that in olve ,. ailing. For example, conge tion
happen on a free, ay because any abnormality in the flow, such as an accident during rush
hour, creates blockage. Congestion in a network or internetwork occur becau e routers and
switches have queues-buffers that hold the packets before and after processing. A router, for
example, has an input queue and an output queue for each interface. If a router cannot process
the pack ts al the same rate at which the arri e, the queues become overloaded and
conge. Lion occurs. Congestion at the tran. port la er i a tually th re ult of onge Lion at the
net, ork layer, which manife 1. it. elf at the transport layer.

2) Explain the concept of sliding window with a neat diagram.


Slidillg Window
Since the sequence numbers use modulo 2m, a circle can represent the sequence
numbers from 0 10 2"'- I (Figure 7). The buffer i repre. enled a. a set of . lice , called
the sliding window, that cupie. part of the cir le at any time. Al the .ender ite, when
a pa ket i.
sent. the corresponding slice is marked. When all the slice are marked, it means that the
buffer i. full and no further me sages can be accepted from the application layer.

When an acknowledgment arri es, 1he corresponding slice is unmarked. Lf some


consecuti e slices from the beginning of the window are unmarked the window slides
over the range of the corresponding equence numbers lo allow more free lice at the end
of the window. Figure 7 hows the liding window at th ender. The s quence numb rs
are in modulo 16 (m = 4) and the size of the \ indm is 7. The sliding windov i. just an
abstraction: the actual silUation uses omputer variables 10 hold the sequence m1mber. of
the next packet to be sent and the la t packet sent.

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

' First \ CXI


{!)Timer h1 ext .
outstanding J to ,tnd to n."CCl\'C

• •• :_- _II I I • • ■ I I • • •

I I
end window Rccei,·c window

Figure 9: Go-Back- protocol

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,

Figure JO: Send \ indow for Go-Back-

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

Fir-l .), Next

:,o: J outstandingt • ,,
to
nd

I :/ 2:, 3-:' 5·--


! - -6

h. Window afterliding (an ACK ith ackNo = 6 h:is arrived)

Figure 11: Sliding the send window


Figure 11 shows how a send window can slide one or more slots to the right when an
acknowledgment arrives from the other end. In the figure, an acknowledgment \ ith ack

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

Figure 12: Receive window for Go-Back-

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

acknowledged, the timer is restarted.


c. If a corrupted A K or an error-free ACK with ack number not related to the outstanding
packet arrive., it is discarded.

d. If a 1im -out occurs, the . ender resend. all out. tanding packet. and re. tart. Lhe timer.

► Blocking state. Three evems may occur in this case:


a. If an error-free ACK arrives with ack o related to one or the outstanding packets, the
. ender slides the window ( el Sf= a o) and if all out landing packet. are a knowledged

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.

c. Ir a corrupted packet arrive., it i. di. arded.

Send Window Size


The . ize of the . end window mu. t be less than 2m i. because for example, choo. e m = 2,
which means the size of the window can be 2m - I, or 3. Figure 14 compares a windmv ize of
3 against a window size of 4. If the size of the window is 3 (less than 2"') and all three
acknowledgments are lost, the only timer expires and all three packets are resent. The receiver
is now expecting packet 3, not packet 0, so the duplicate packet i. correctly discarded. On
lhe other h nd, if th . ize or the indow i. 4 (equal to 22) and all a knowledgment. are
lo t, the . ender will send a duplicate of pa ket 0. However, Lhi time the \ indow of lhe
recei er e, pect to receive packet 0 (in the next cycle), so it accepts packet 0, not as a
duplicate, bUL as the fir t packet in the next cycle. This is an error. This hows thai lhe size of
the send window must be less than zm.

ender ende Receiver


r
(art J II

" m§i

"@I!IDi!
Timc-oi11:
rt',larl Y
Time Time

,1. .'end ,·indmv {If,itt' < _"'

Figure 14 Send window ize for Go-Back-N


Example 1
Figure 15 hows an example of Go-Back- . This i. an example of a ca. e where the forward
hannel i reliable, but the rever e i not. No data packet. are lo. t, but some ACKs are
delayed and one i. I . t. The example al. o. hows how cumulative aclrnowledgments an help
if acknowledgments are delayed or lo. 1.

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).

32-bit source JP address

Figure 20: P. eudoheader for checksum caJculation


If Lhe checksum does not. include the p. eudoheader, a u er datagram ma arrive afe
and sound. However, if the IP header i corrupted, it may be delivered 10 the wrong host..The
protocol field i. added to en. ure that the packet belongs to DP, and not to TCP. We will .ee
later that if a proce scan u. e either UDP or TCP, the de. 1ination pon number can be the same.
The value of the pr to ol field r UDP is 17. If this value i. hanged during

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.

Encap ulation and Decap. ulation


To send a message from one process lo another, the UDP protocol encapsulates and
decapsulates messages.

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.

Multiplexing and Demultiplexing


In a ho. I running a TCP/IP protocol suite, there is only one DP but po. sibly several
processe Ihat may want 10 use the services of UDP. To handle thi. ituation, UDP
mul1iplexes and demultiplexes.

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.

< DP is used for management proces. es such as SNMP.


< DP is used for some route updating protocols such as Routing Information Protocol (RIP).

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

ourcc por1 address Dcsti nation por1 add n:ss


16 bilS l6 bilS
Sequence number
32 bits
Acknowledgment
number 32 bits
Window size
16 bi Ls

b. Hc:,der

Figure 23.1: TCP segment format


< Source port addres . Thi. is a 16-bit field that defines the port number of the application
program in the host lhat is sending the segment.
< Destination port address. This i a 16-bit field that defines the port number of the
application program in the host that is receiving the segment.
< Sequence number. Thi 32-bit field defines the number a. signed Lo t.he first byte of data
contained in thi egmenl. As we. aid before, TCP i. a stream transport protocol. To ensure
connectivity, each byte to be mm. mined is numbered. The equence number tells the
de tination which byte in this sequence i the first byte in the segmenl. During connection
establishment, each pru1y uses a random number generator to create an iniLial sequence
number (ISN), whi h i u. uaHy different in each direction.

< 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

URG. Urgcnr pointer i 1,1hd


ACK: Ad:nowledgmem i valid
P H : Rcquc51for pu. h
R • Reset the rnnn l"Uin
YN: ynchroniic sequeocc numbers
Fll'i' Tcrmin:.itc the ,·onnc,tion

< 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

You might also like