CHAPTER 6 - The Transport Layer - Study Unit 6

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

CHAPTER 6

(Study Unit 4)
The Transport Layer
(TCP and UDP)
In this Lecture:

 Transport Layer Design Issues:


o Multiplexing/Demultiplexing
o Reliable Data Transfer
o Flow control
o Congestion control
 UDP
 TCP
o Header format, connection
management, checksum
o Congestion Control
©2020Raj Jain
TCP/IP AND OSI MODEL RELATIONSHIP( A revision)
Data
conversion
OSI MODEL stages
TCP/IP MODEL
APPLICATION LAYER
Data APPLICATION LAYER
ION
T
L ICA LAYER
PRESENTATION LAYER P YER
PRESENTATION
P
A LA
SESSION LAYER
SESSION LAYER

TRANSPORT LAYER Segments TRANSPORT LAYER

NETWORK LAYER Packets NETWORK LAYER

DATA LINK LAYER Frames R K


DATA LINKOLAYER
E TW SS
N C ELAYER
C
PHYSICAL
A In this chapter we
PHYSICAL LAYER bits focus on TCP and
UDP at the
Transport Layer
Transport Layer Design Issues
1. Transport Layer Functions
2. Multiplexing and Demultiplexing
3. Error Detection: Checksum
4. Flow Control
5. Efficiency Principle
6. Error Control: Retransmissions
Transport Layer
Duties of the Transport Layer(cont’d)

• The services provided by transport layer


protocols:
End-to-End Delivery

• The network layer treats each packet as an


independent entry, even those belonging to a
single message.

• The transport layer oversees the end-to-end


(source-to-destination) delivery of an entire
message.
Addressing

• Levels of Service Access Points


– Data link level protocols need to know which two
computers within a network are communicating.
• MAC address
– Network level protocols need to know which two
computers within an internet are communicating.
• IP address
– Transport level protocols need to know which
upper-layer protocols are communicating.
• Port
Addressing (cont’d)

• In transport layer, service access points(Port


numbers) identifies upper-layer services
(applications).
Reliable Delivery(cont’d)
• Error Control
– Mechanisms for error control are based on error detection and
retransmission.
– Error detections are performed using algorithms implemented in
software, such as checksum.
• Sequence Control
– What is important is that segments are properly reassembled at
the destination.
• Segmentation and Reassembly
– Transport layer adds a sequence number at each segment.
– This number indicates the order for reassembly.
– Each segment carries a field that indicates whether it is the final
segment or middle segment of a transmission.
Reliable Delivery(cont’d)
• Concatenation and Separation
– When the size of the data unit belonging to a single session is so small
that several units can fit together into a single datagram.
– A sequence number at each unit allows correct separation at the
destination.
• Error Control
– Mechanisms for error control are based on error detection and
retransmission.
– Error detections are performed using algorithms implemented in
software, such as checksum.
• Loss Control
– Sequence numbers allow the receiver’s transport layer protocol to
identify any missing segments and request redelivery.
• Duplication Control
– Sequence numbers allow the receiver to identify and discard duplicate
segments.
Flow Control

• Flow control at this layer is performed end-to-end rather


than across a single link.

• A sliding window is used to make data transmission more


efficient as well as to control the flow of data so that the
receiver does not become overwhelmed.

• Some points about sliding windows at the transport layer:


– The sender does not have to send a full window’s worth of
data.
– An acknowledgment can expand the size of the window based
on the sequence number of the acknowledged data segment.
– The size of the window can be increased or decreased by the
receiver.
– The receiver can send an acknowledgment at anytime.
Protocol Layers
Top-Down approach
Application HTTP FTP SMTP P2P DNS Skype

Transport TCP UDP

Internetwork IP

Host to
Ethernet Point-to-Point Wi-Fi
Network

Physical Coax Fiber Wireless

©2020Raj Jain
Multiplexing and Demultiplexing
Transport Ports and Network addresses are used to separate flows

©2020Raj Jain
Multiplexing
• Upward Multiplexing
– The transport layer can send several transmissions bound for the same
destination along the same path.
– It is useful when the underlying networks have high throughput.
• Downward Multiplexing
– It is useful when the underlying networks have low or slow capacity(e.g.,
X.25’s three bit sequence code).
Protocol Data Units (PDU)
• At each layer, protocols are used to communicate
• Control information is added to user data at each
layer (PDU = Control + Data)
• Transport layer may fragment user data
• Transport layer may fragment user data
• Each fragment has a transport header added
– Destination SAP (port)
– Sequence number
– Error detection code
PROTOCOLS AT THE TRANSPORT LAYER
TRANSMISSION CONTROL PROTOCOL(TCP)
Basic Features
•TCP provides connection-oriented communication (virtual
circuit connection, like telephone communication). It manages
a point-to-point and full-duplex connection for an application
between two computers:
i. creates a connection before communication;
ii. sends and receives data over this connection;
 Application data is considered to be a continuous unstructured
stream of bits.
 Application programs must understand stream contents and
boundaries of records.
 Piggybacking permitted
iii. closes a connection after communication.
•TCP guarantees reliable data delivery.
The TCP recipient will receive data in a correct order without data loss
or error.
•Connection abstraction
---- TCP allows multiple application programs on a given
machine to communicate with programs in other
machines.
---- A virtual circuit connection consists of two endpoints.
Each endpoint is a pair of integers (host, port)
Host = IP address
A port is a positive integer on the host, usually
identifying an application program, e.g.,FTP: 20 and
21,SMTP: 25,HTTP: 80
----- Functionality of a port number:
Helps a sender get specific data to a specific
application program at the recipient’s end.
NB A socket – Is a combination of an IP Address and a port
number e.g. the socket on 192.161.7.5 for port 69 is
192.161.7.5:69. OR 192.161.7.5,UDP
Well-known ports used by TCP
TCP 3-WAY HANDSHAKE
Before data transmission, a Sender and Recipient must
have a controlled interaction called a 3-way handshake.
---- reason why TCP is known to connection oriented
This process has 3 parts.

PART 1 – The sender transmits a TCP segment with a


Synchronization(SYN) bit set(the primary value of negotiation
here is a Sequence number).
“Let us start our communication
with a Sequence Number”

DATA SENDER
DATA RECIPIENT

SYN
PART 2 – The Recipient responds with a TCP Segment along
with the Synchronization(SYN) and Acknowledgement(ACK)
bit sets i.e. “SYN/ACK”

SYN
DATA SENDER
DATA RECIPIENT
SYN/ACK

PART 3 – The sender responds with an ACK!


SYN
DATA SENDER
SYN/ACK
DATA RECIPIENT

ACK

AFTER THESE STAGES/PROCESSES,DATA TRANSMISSION NOW BEGINS


Note: UDP doesn’t use a 3-way handshake prior to data transmission,
as we shall later on see
TCP’s ERROR DETECTION AND ERROR RECOVERY
These are not actually the same!
FEATURE
•Error detection is “finding the error”
•Error recovery is actually “doing something about it”
TCP does both error detection and error recovery by
using the Sequence number and
Acknowledgement(ACK) in the TCP Header.
Example:
A host is sending 4 segments to another host, each of the
segments has a sequence number, that sequence number tells the
recipient in what order to reassemble the segments.(which a
fundamental concept in error detection and recovery).
Let us assume the first segment has a sequence number of 100
and we’ll add 100 to the subsequent sequence numbers.
Seq 100

Seq 200
DATA SENDER DATA RECIPIENT
Seq 300

Seq 400
The recipient will now send a segment back that contains no data but
does have an ACK number set. You might think that the ACK number
would actually reflect the last sequence number received butsits not the
case – The ACK number will actually indicate the next sequence number
the data recipient expects to see!
Seq 100

Seq 200

DATA SENDER DATA RECIPIENT


Seq 300

Seq 400

ACK 500
 What if “Seq 200” didn’t arrive(got lost) at the recipient but Seq
100,300 and 400 all arrived, what will happen?
Seq 100

Seq 200
DATA SENDER DATA RECIPIENT
Seq 300

Seq 400
ACK number will be 200,this is error detection
ACK 200 – “finding out the error”

Seq 200 Seq 200 is retransmitted, this is error recovery


– “doing something about the error”
ACK 500
 Another possibility could be, what happens when the ACK
number itself is lost?
Seq 100

Seq 200
DATA SENDER DATA RECIPIENT
Seq 300

Seq 400

ACK 500

Sender sets an Acknowledgement timer which is activated


immediately upon ‘Seq 400’ being sent.
If an Ack is not received during that time and the time expires, the
sender will re-transmit the segments. This process is called POSITIVE
ACKNOWLEDGE with RETRANSMISSION(PAR)
 TCP WINDOWING CONCEPT
 this refers to the amount of data that a data sender is allowed to
transmit without waiting for an “ACK”.
Assuming each segment in the previous example was 600 bytes in
size, what is the size of the window ?
------- The window size is 2400 bytes. – This means that the sender
can transmit 2400 bytes before it has to stop and wait for an ‘ACK’.
The data recipient decides the size of the window, NOT the sender.
This gives the recipient some control over how much data is sent
hence the “ Flow Control”  If there are no errors happening during
“the size of the window is 2400 bytes” transmission, then the Data Recipient
can increase the Window to 3400 bytes.
“NO errors, the size of the window is now  As soon as errors start occurring,eg the
3400 bytes”
buffer at the recipient overflows, then
the recipient will now “slide” (reduce)
Am beginning to see errors I’ll reduce
“the size of the window to 2400 bytes”
the window size backwards e.g. to may
2400 bytes.
 This process is known as “Sliding
DATA SENDER DATA RECIPIENT Window” – the dynamic adjustment of
the window size.
Lets try it!!!!
1 . 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.
2. 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.
 TCP Header

Source Port -- Identifies the port number of a source application program.


Destination Port -- Identifies the port number of a destination application program.
Sequence Number -- Specifies the sequence number of the first byte of data in this
segment.
Acknowledgment Number -- Identifies the position of the highest byte received.
Data Offset -- Specifies the offset of data portion of the segment.
 TCP Header

Reserved -- for future use.


Control bits -- identify the purpose of the segment:
URG -- Urgent pointer field is valid.
ACK -- Acknowledgement field is valid.
PSH -- Segment requests a PUSH.
RTS -- Resets the connection.
SYN --Synchronizes the sequence numbers.
FIN -- Sender has reached the end of its byte stream.
Window -- Specifies the amount of data the destination is willing to accept.
Urgent Pointer -- Indicates data that is to be delivered as quickly as possible. Thi
pointer specifies the position where urgent data ends.
Options + Padding – used to ensure that the TCP header ends and Data begins
on a 32 bit boundary
Note: UDP doesn’t have windowing Capabilities.
The challenge therefore is,UDP doesn’t have all the TCP features
discussed….Why doesn’t UDP offer these features? Why do we use UDP
anyway?
THE DIFFERENCE IN THE ‘HEADERS’ ANSWERS THIS QUESTION , thus
UDP cannot offer the same features because it doesn’t have the TCP
Header fields; the only fields it has in common are The Source Port ,
Destination Port and a Checksum
USER DATAGRAM PROTOCOL(UDP)
The User Datagram Protocol (UDP) is called a
connectionless, unreliable transport protocol.
It does not add anything to the services of IP except to
provide process-to-process communication instead of
host-to-host communication.
Basic Features Of UDP
• UDP is a connectionless transport protocol.
– A UDP application sends messages without establishing and
then closing a connection.
– UDP has a smaller overhead then TCP, especially when the
total size of the messages is small.
• UDP does not guarantee reliable data delivery.
– UDP messages can be lost or duplicated, or they may
arrive out of order; and they can arrive faster than the
receiver can process them.
– The application programmers using UDP have to consider
and tackle these issues themselves.
• UDP has no mechanism for flow control.
• Difference between UDP and IP
– UDP distinguishes among applications within a given host
via the destination port number; an IP datagram only
identifies a destination host via the IP address.
 UDP Header

– The header consists of 8 bytes.


– The data can have a variable size.
NB, the purpose of these fields remain the
same.
Well-known ports used with UDP
SUMMARY OF THE TWO PROTOCOLS IN FORM OF A
COMPARISON
TRANSMISSION CONTROL USER DATAGRAM PROTOCOL
PROTOCOL (TCP) (UDP)
•Guarantees delivery of •Best effort delivery of segments
segments
•Has error detection and •There is no error detection and
recovery via the sequence number recovery
and ACK number
•There Windowing •No Windowing
•It is connection oriented •It is connectionless
•High overload(Header is 20 •Low overload(header is 8
Octets) Octets)
•There is flow control •No flow control

You might also like