Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

Chapter 24

Transport
Layer
Protocols

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 3: Outline

24.1 INTRODUCTION

24.2 UDP

24.3 TCP

24.4 SCTP
Figure 24.1: Position of transport-layer protocols in the TCP/IP
protocol suite

24.3
24.24.1 Services

Each protocol provides a different type of service


and should be used appropriately.

24.4
24.24.2 Port Numbers

As discussed in the previous chapter, a transport-


layer protocol usually has several responsibilities.
One is to create a process-to-process
communication; these protocols use port numbers to
accomplish this. Port numbers provide end-to-end
addresses at the transport layer and allow
multiplexing and demultiplexing at this layer, just as
IP addresses do at the network layer. Table 24.1
gives some common port numbers for all three
protocols we discuss in this chapter.

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

24.6
24-2 UDP

The User Datagram Protocol (UDP) is a


connectionless, unreliable transport protocol.
If UDP is so powerless, why would a process
want to use it? With the disadvantages come
some advantages. UDP is a very simple
protocol using a minimum of overhead.

24.7
24.2.1 User Datagram

UDP packets, called user datagrams, have a fixed-


size header of 8 bytes made of four fields, each of 2
bytes (16 bits). Figure 24.2 shows the format of a
user datagram. The first two fields define the source
and destination port numbers. The third field
defines the total length of the user datagram, header
plus data. The 16 bits can define a total length of 0
to 65,535 bytes. However, the total length needs to be
less because a UDP user datagram is stored in an IP
datagram with the total length of 65,535 bytes. The
last field can carry the optional checksum
(explained later).
24.8
Figure 24.2: User datagram packet format

24.9
24.2.2 UDP Services

Earlier we discussed the general services provided


by a transport-layer protocol. In this section, we
discuss what portions of those general services are
provided by UDP.

24.10
24-3 TCP

Transmission Control Protocol (TCP) is a


connection-oriented, reliable protocol.
TCP explicitly defines connection
establishment, data transfer, and
connection teardown phases to provide a
connection-oriented service. TCP uses
flow and error control mechanisms to
provide reliability.

24.11
24.3.1 TCP Services

Before discussing TCP in detail, let us explain the


services offered by TCP to the processes at the
application layer.
a) Process to Process Communication

b)Stream Delivery Service

c) Connection Oriented Service

d)Reliable Service

24.12
Figure 24.4: Stream delivery

Sending Receiving
process process

Stream of bytes

TCP is a stream oriented protocol because it allows the sending


process to deliver data as a STREAM of BYTES and allows the
receiver process to receive data as a STREAM of BYTES

24.13
Figure 24.5: Sending and receiving buffers
Sending
process Receiving
process

Stream of bytes

• TCP need Buffers to store stream of bytes both at the sending process and the receiving process because
sending and receiving process may not write or read data at the same speed.

• Normally the size of buffers varies from hundred to thousand bytes.

• Buffer at the sending process is divided into 3 chambers


Blue Area - Contain those bytes that are already sent but their acknowledgement has not arrived.
Green Area- Contains bytes that are to be sent.
White Area – Contain empty chambers in which next bytes of data to be sent are written .

Buffer at the Receiving process is divided into two chambers


White Area- Contains empty chambers in which the incoming bytes from the sending process will be received
Blue Area-Contains Received bytes that can be read by the receiving process.
24.14
Figure 24.6: TCP segments

• The Stream of Bytes generated at the Transport Layer are grouped


together to create Segment(s) which will then passed to the Network
Layer .

• The Segments may be off different size.

• These segments are encapsulated in the Packet at the Network Layer and
further passed to the Data Link Layer and the Physical Layer for the
24.15 transmission.
24.3.2 TCP Features
a) Byte Number b)Sequence Number

What TCP do when it receive the stream of Bytes from the Process.
TCP do the following tasks
a) It store the incoming bytes of data into Buffer.

b)TCP numbers all the data bytes by generating the random number between 0
and 2^ 32-1 for the number of First byte.

c) It group the bytes to create the Segment and assign the Sequence number to
each segment .

d) The sequence number of each segment is usually the number of the First
Byte.

24.16
Example 24.7
Suppose a TCP connection is transferring a file of 5,000
bytes. The first byte is numbered 10,001. What are the
sequence numbers for each segment if data are sent in five
segments, each carrying 1,000 bytes?
Solution
The following shows the sequence number for each
segment:

1000 Segment 1 :10001 + 999 = 11000


Segment 2 : 11001 +999 = 12000

24.17
Acknowledgement Number
• TCP waits for the acknowledgement of the bytes that it send to the
receiver.

• The Receiver always send the Cumulative Acknowledgement


Number to the sender .

• The Cumulative Acknowledgement Number defines the Number of


the next byte that the receiver excepts to receive.

• If the receiver sends 5643 as an acknowledgement number then it


means that the receiver has received all the bytes from the
beginning up to 5642.

24.18
24.3.3 Segment

Before discussing TCP in more detail, let us discuss


the TCP packets themselves. A packet in TCP is
called a segment.

24.19
Figure 24.7: TCP segment format

24.20
Figure 24.8: Control field

24.21
Figure 24.9: Pseudoheader added to the TCP datagram

24.22
24.3.4 A TCP Connection

• TCP is connection-oriented.

TCP connection is logical, not physical

• All of the segments belonging to a message are


then sent over this logical path.

• TCP uses the services of IP to deliver individual


segments to the receiver, but it controls the
connection itself.

24.23
Figure 24.10: Connection establishment using three-way handshaking

24.24
Figure 24.11: Data transfer

24.25
Figure 24.12: Connection termination using three-way handshaking

24.26
TCP uses a Sliding Window Protocol to handle the FlowControl.
We already see the concept of Sliding window in DataLink Flow Control where
the window is maintained both at the sender and the receiver side.
In Data Link the Window describes the Number of Frames than can be
simultaneously transmitted from the sender towards the receiver while in wait
for the Acknowledgement .
In Data link - Go Back n and Selective Repeat works on the concept of Sliding
Window. The size of the Window at the sender and the receiver remains fixed.
Go Back N : Sender window size is 2 k - 1.
Receiver window size is 1.
Selective Repeat: Sender window size is 2 k - 1.
Receiver window size is 2 k - 1.
But when we look the Sliding Window at the Transport Layer
The size of the TCP sliding window at the Transport Layer is variable.
In TCP we divide the data received from the Higher Layers into manageable
units called as Segments.
The Segments are Byte Oriented .
TCP assigns a sequence number to each segment. Usually the sequence
number is number given to the First Byte present in the segment.
Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte is
numbered 10,001. What are the sequence numbers for each segment if data are
sent in five segments, each carrying 1,000 bytes?
Solution
The following shows the sequence number for each segment:
In TCP sliding window protocol the size of the sender
window depends upon two paramters
a) Receiver Window Size ( rwnd) which is advertised by
the receiver to sender for not overwhelming him.
b) Congestion Window Size(cwnd) which is determined by
the Network to avoid the Congestion.

Sender window size = min(rwnd, cwnd).


The size of the sender window is the lesser of rwnd and
cwnd.
What is the value of the receiver window (rwnd) for host A
if the receiver, host B, has a buffer size of 5000 bytes and
1000 bytes of received and unprocessed data?
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to A.
What is the size of the window for host A if the value of
rwnd is 3000 bytes and the value of cwnd is 3500 bytes?
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
24.32

You might also like