This document discusses the transport layer and TCP/IP protocols. It provides an overview of transport layer services including process-to-process communication, encapsulation and deencapsulation, multiplexing and demultiplexing, flow control, and error control. Connection-oriented and connectionless services are described. TCP and UDP are examined in detail, covering TCP segments, connections, congestion control, and reliable data transfer. Specific transport layer protocols like Go-back-N and Selective Repeat are summarized.
Filters for Electromagnetic Compatibility Applications
Transport layer
1. Transport Layer
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
Dr. SHANTHI S
Associate Professor
Computer Science & Engineering
Kongu Engineering College
Perundurai, Erode, Tamilnadu
2. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
UNIT – IV
Transport Layer: Transport Layer Services –
Connectionless and Connection Oriented Services –
Transport Layer Protocols: Go-back-N ,
Selective Repeat – UDP – TCP: TCP Services –
TCP Features – TCP Segment – TCP Connection –
TCP Congestion Control.
5. Types of data deliveries
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
6. Addressing: Port Numbers
port numbers are integers 0 -65,535 (16 bits)
ICANN Ranges
1. well-known port numbers => used by server
0 – 1023. Assigned & Controlled by
ICANN
2. ephemeral port number => used by client
1024 – 49151 Registered & not Assigned &
Controlled
3. Dynamic port 49152 – 65535
Not Registered & not Assigned & Controlled
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
9. Socket Addresses
The combination of an IP address and a port
number is called as socket address
A pair of client socket address and the server
socket address are part of the network-layer packet
header and the transport-layer packet
header.
The IP header contains
the IP addresses;
Transport layer header
=> the port numbers.
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
11. Flow Control
Pushing or Pulling
one of the solutions is normally to use two Buffers
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
12. Error Control
Error control at the transport layer is responsible for
1. Detecting and discarding corrupted packets.
2. Keeping track of lost and discarded packets and
resending them.
3. Recognizing duplicate packets and discarding them.
4. Buffering out-of-order packets until the missing packets
arrive.
Sequence Numbers => 2m − 1; m=> No of bits to
represent sequence no.
Acknowledgment
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
13. Combination of Flow & Error Control
Sliding Window
The buffer is
represented as a
set of slices,
called the
sliding window,
that occupies part
of the circle at
any time
Window Size=7
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
14. Combination of Flow & Error Control
Window Size=7
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
15. Congestion Control
Congestion in a network may occur if the load on the
network—the number of packets sent to the network—is
greater than the capacity of the network
Congestion control refers to the mechanisms and
techniques that control the congestion and keep the load
below the capacity
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
17. Connection-Oriented Service
Make a connection-
oriented protocol at
the transport layer
over either a
connectionless
(Datagram
Approach) or
connection-oriented
(Virtual Circuit)
protocol at the
network layer.
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
18. Flow Control - Simple Protocol
Flow diagram
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
21. Think!
Assume that, in a Stop-and-Wait system, the bandwidth of the
line is 1 Mbps, and 1 bit takes 20 milliseconds to make a round
trip. What is the bandwidth-delay product? If the system data
packets are 1,000 bits in length, what is the utilization percentage
of the link?
bandwidth-delay product (Capacity) = BW X Delay
utilization percentage = packet length/Capacity
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
22. Think!
Assume that, in a Stop-and-Wait system, the bandwidth of the
line is 1 Mbps, and 1 bit takes 20 milliseconds to make a round
trip. What is the bandwidth-delay product? If the system data
packets are 1,000 bits in length, what is the utilization percentage
of the link?
bandwidth-delay product (Capacity) = BW X Delay
= (1 × 106) × (20 × 10−3) = 20,000 bits
utilization percentage = packet length/Capacity
=1,000/20,000 = 5%
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
23. Go-Back-N Protocol (GBN) - Sender
The send
window can
slide one or
more slots when
an error-free
ACK
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
24. Go-Back-N Protocol (GBN) - Receiver
Timers
Although there can be a timer for each packet that is sent, in our
protocol we use only one.
Receiver
Resending packets
When the timer expires, the sender resends all outstanding packets
sender has already sent packet 6 and the only timer expires &
ACK has received for packets 2; the sender goes back and resends
packets 3, 4, 5, and 6 => GO-BACK-3
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
25. Go-Back-N
Sf => sequence number of the
first (oldest) outstanding packet
Sn => Next to send ;
Rn => accepted & ACK
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
28. Selective Repeat (SR)
Windows
Maximum size = 2m−1
m = 4, SN=> 0 to 15,
Window size=8
Acknowledgments
AckNo defines the sequence
number of a single packet that is
received safe
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
31. Think ! GBN & Selective Repeat (SR)
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and 5.
The sender receives an ACK with ackNo = 3. What is the
interpretation if the system is using GBN or SR?
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
32. Think ! GBN & Selective Repeat (SR)
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and 5.
The sender receives an ACK with ackNo = 3. What is the
interpretation if the system is using GBN or SR?
In GBN, 0, 1 and 2 received successfully and the
packets from 3 ( 3,4 and 5) need to be retransmitted
In SR, only packet with sequence no. 3 received
successfully
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
33. Go-Back-N Selective Repeat
All the frames are re-transmitted from the
lost packet to the last packet transmitted.
Only those frames are re-transmitted
which are found suspected.
Sender window size of Go-Back-N
Protocol is N
Sender window size of selective Repeat
protocol is also N
Receiver window size of Go-Back-N
Protocol is 1
Receiver window size of selective Repeat
protocol is N
Type of Acknowledgement is cumulative Type of Acknowledgement is individual
Out-of-Order packets are NOT Accepted Out-of-Order packets are Accepted
Go-Back-N Protocol is less complex Selective Repeat protocol is more complex
Efficiency of Go-Back-N Protocol is
N/(1+2a)
Efficiency of selective Repeat protocol is
also N/(1+2a),
where a = tp/tt.
Where tp is propagation delay and tt is the transmission delay
Go-Back-N vs Selective Repeat
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
34. Goback-N & Repeat (SR)
A sender wants to transmit 10 data packets to the receiver.
Out of these 10 data packets, every 4th data packet is lost.
How many packets sender will have to send in total using
i) Go-Back-N?
ii) Selective Repeat ?
Solution ?
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
35. Selective Repeat VS Selective Repeat (SR)
A sender wants to transmit 10 data packets to the receiver.
Out of these 10 data packets, every 4th data packet is lost.
How many packets sender will have to send in total using
i) Go-Back-N?
ii) Selective Repeat ?
Solution @ https://youtu.be/dinR1zht598
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
41. Bidirectional Protocols: Piggybacking
Simple, Stop & Wait, Goback-N, Selective
repeat => unidirectional
In all, data packets flow in only one direction and
acknowledgments travel in the other direction
Piggybacking => acknowledgments also need to
flow in both directions
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
44. USER DATAGRAM PROTOCOL (UDP)
connectionless, unreliable transport protocol
Services: Process-to-Process Communication,
Connectionless Services, No Flow Control
Lack of Congestion Control
No Error Control
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
45. Optional Inclusion of Checksum
The sender of a UDP packet can choose not to calculate the
checksum => checksum field is filled with all 0s
17
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
46. TRANSMISSION CONTROL PROTOCOL (TCP)
TCP Services
Process-to-Process Communication
Stream Delivery Service
Full-Duplex Communication
Multiplexing and Demultiplexing
Connection-Oriented Service => three phases process
Reliable Service
TCP Features
Numbering System => Sequence Number,
Acknowledgment Number
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
47. TRANSMISSION CONTROL PROTOCOL (TCP)
Sequence Number
1. The sequence number of the first segment is the ISN
(initial sequence number), which is a random
number.
2. The sequence number of any other segment is the
sequence number of the previous segment plus the
number of bytes carried by the previous segment.
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
48. TRANSMISSION CONTROL PROTOCOL (TCP)
Sequence Number
Suppose a TCP connection is transferring a file of 5000
bytes. The first byte is numbered 10001. What are the
sequence numbers for each segment if data are sent in
five segments, each carrying 1000 bytes?
ISN = 10001
Sequence no. of 1st segment = 10001
Sequence no. of 2nd segment = 10001 + 1000 = 11001
Sequence no. of 3rd segment = 11001 + 1000 = 12001
….
ACK for 1st = 11001; 2nd = 12001….
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
51. TCP Connection Establishment
Three way Hanshaking
Window
Size
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
SYN, SYN+ACK segment cannot
carry data & consumes sequence
no.
52. TCP - SYN Flooding Attack
one or more malicious attackers send a large number of SYN
segments to a server pretending that each of them is coming
from a different client by faking the source IP addresses in the
datagrams
server, assuming that the clients are issuing an active open,
allocates the necessary resources (SYN + ACK => fake clients)
denial of service attack
Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
59. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control
Rwnd => size of sender window, is controlled by receiver
TCP is an end-to-end protocol that uses the service of
IP & IP is a simple protocol with no congestion
control
TCP need to take care of congestion in intermediate
network
TCP needs to define policies that accelerate the data
transmission when there is no congestion and reduce
the transmission speed when congestion is detected
To control the number of segments to transmit, TCP
uses another variable called a congestion window,
cwnd
60. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control
The cwnd variable and the rwnd variable together
define the size of the send window in TCP
Actual window size = minimum (rwnd, cwnd)
Congestion Detection
The TCP sender uses the occurrence of two events as
signs of congestion in the network:
1. time-out => lost due to congestion
2. receiving three duplicate ACKs => segment has been
delayed due to congestion
61. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control - Congestion Policies
1. Slow Start: Exponential Increase
Initially
cwnd to 1 MSS
If an ACK arrives,
cwnd = cwnd + 1.
62. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control - Congestion Policies
2. Congestion Avoidance: Additive Increase
If an ACK arrives,
cwnd =cwnd + (1/cwnd)
Cwnd= 4+ ¼ th of cwnd
= 4+1
63. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control - Congestion Policies
3 . Fast Recovery
is optional in TCP
It starts when three duplicate ACKs arrive
If a duplicate ACK arrives, cwnd = cwnd + (1 / cwnd).
64. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control – Policies Transition
1. Taho TCP
Uses only => slow start and congestion avoidance
69. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Congestion Control – Policies Transition
3. New Reno TCP =>
Additive Increase, Multiplicative Decrease (AIMD)
70. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
TCP Throughput
Wmax = (10 + 12 + 10 + 8 + 8) / 5
= 9.6 MSS
Throughput = (0.75 Wmax / RTT)
= 0.75 × 960 kbps / 100 ms
= 7.2 Mbps
Throughput = (0.75)*Wmax / RTT
Wmax is the average of window sizes when the congestion occurs
If MSS = 10 KB (kilobytes) and RTT = 100 ms. What is the
throughput for the transmission shown in the figure?
71. Dr. S.Shanthi/ASP/CSE/Kongu Engg. College
Reference
Behrouz A. Forouzan, ―Data Communications and
Networking‖, McGraw-Hill, 5th Edition, 2015