0% found this document useful (0 votes)
3 views

Week-3

The document discusses the transport layer of computer networks, focusing on connection establishment and handling delayed duplicates. It outlines various solutions for ensuring reliable data delivery, including the use of unique identifiers and mechanisms to restrict packet lifetime. Additionally, it addresses the challenges of managing sequence numbers and the importance of synchronization between sender and receiver during connection requests.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Week-3

The document discusses the transport layer of computer networks, focusing on connection establishment and handling delayed duplicates. It outlines various solutions for ensuring reliable data delivery, including the use of unique identifiers and mechanisms to restrict packet lifetime. Additionally, it addresses the challenges of managing sequence numbers and the importance of synchronization between sender and receiver during connection requests.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 90

COMPUTER NETWORKS AND

INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR

1
Transport Layer - I (Services)
Application Application
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Protocol Stack Implementation in a Host
Application

Transport
Software, Kernel
Network

Data Link
Firmware, Device Driver
Physical
Hardware
How Application Data Passes Through Different Layers
HTTP
HTTP Data
Application Header

TCP
Transport Layer Data
Transport Header

IP
Network Header
Network Layer Data

Data Link MAC


Data Link Layer Data
Header

PHY MAC IP TCP HTTP PHY


Physical Header Header Header Header Header
HTTP Data
Trailer
Transport Layer Services

Flow and
End to end Connection Reliable Data Ordered Packet
Congestion
packet delivery Establishment Delivery Delivery
Control

UDP Transport TCP

Datagram delivery (unreliable)

Network
6
COMPUTER NETWORKS AND
INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR

1
Transport Layer - II (Connection I)
Application Application
Connection
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Connection Establishment
Serve
Client
r
CONNECT LISTEN

• This is a simple primitive for connection establishment – but does


this work good?
Connection Establishment
• Consider a scenario when the network can lose, delay, corrupt and duplicate
packets (the underline network layer uses unreliable data delivery)

• Consider retransmission for ensuring reliability – every packet uses different paths
to reach the destination

• Packets may be delayed and got struck in the network congestion, after the
timeout, the sender assumes that the packets have been dropped, and
retransmits the packets
Connection Establishment
Serve
Client
r
CONNECT LISTEN
It may happen that the
server has crashed and
reinitiated the
connection. So
distinguishing between
these two is essential

• How will the server differentiate whether CONNECTION REQ-1 is a


new connection request or a duplicate of the CONNECTION REQ-2?
Connection Establishment
• Protocol correctness versus Protocol performance – an eternal
debate in computer networks …

• Delayed duplicates create a huge confusion in the packet switching


network. A major challenge in packet switching network is to develop
correct or at least acceptable protocols for handling delayed duplicates
Connection Establishment – Handling Delayed Duplicates
• Solution 1: Use Throwaway Transport Address (Port Numbers)
– Do not use a port number if it has been used once already – Delayed
duplicate packets will never find their way to a transport process
– Is this solution feasible?

• Solution 2: Give each connection a unique identifier chosen by the


initiating party and put in each segment
– Can you see any problem in this approach?
Connection Establishment – Handling Delayed Duplicates
• Solution 3: Devise a mechanism to kill off aged packets that are still
hobbling about (Restrict the packet lifetime)
– Makes it possible to design a feasible solution
Connection Establishment – Handling Delayed Duplicates
• Three ways to restrict packet lifetime
– Restricted Network Design – Prevents packets from looping (bound
the maximum delay including congestion)
– Putting a hop count in each packet – initialize to a maximum value
and decrement each time the packet traverses a single hop (most
feasible implementation)
– Timestamping each packet – define the lifetime of a packet in the
network, need time synchronization across each router.
Connection Establishment – Handling Delayed Duplicates

• Design Challenge: We need to guarantee not only that a


packet is dead, but also that all acknowledgements to it are
also dead
Connection Establishment – Handling Delayed Duplicates
• Let us define a maximum packet lifetime T – If we wait a time T secs
after a packet has been sent, we can be sure that all traces of it (packet
and its acknowledgement) are now gone

• Rather than a physical clock (clock synchronization in the Internet is


difficult to achieve), let us use a virtual clock – sequence number
generated based on the clock ticks
Connection Establishment – Handling Delayed Duplicates

• Label segments with sequence numbers that will not be reused


within T secs.

• The period T and the rate of packets per second determine the size of
the sequence number – at most one packet with a given sequence
number may be outstanding at any given time
Sequence Number Adjustment
• Two important requirements (Tomlinson 1975, Selecting Sequence
Numbers)

– R1. Sequence numbers must be chosen such that a particular


sequence number never refers to more than one byte (for byte
sequence numbers) at any one time
– How to choose the initial sequence number
Sequence Number Adjustment
• Two important requirements (Tomlinson 1975, Selecting Sequence
Numbers)

– R2: The valid range of sequence numbers must be positively


synchronized between the sender and the receiver, whenever a
connection is used
– Three way handshaking followed by the flow control mechanism –
once connection is established, only send the data with expected
sequence numbers
Initial Sequence Number during Connection Establishment
Conn 2
initialized

Sequence Numbers
Conn 1
crashed Connection 2

Connection 1

Time
Packet Lifetime T
• A Delayed duplicate packet of connection 1 can create a confusion for
connection 2
What We Ideally Want? Either …

Conn 2

Sequence Numbers
Conn 1 initialized
crashed

Connection 2

Connection 1

Time
Packet Lifetime T
What We Ideally Want? Or …
Conn 2
initialized

Connection 2

Sequence Numbers
Conn 1
crashed

Connection 1

Time
Packet Lifetime T
18
COMPUTER NETWORKS AND
INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR

1
Transport Layer - III (Connection II)
Application Application
Connection
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Initial Sequence Number during Connection Establishment
Conn 2
initialized

Sequence Numbers
Conn 1
crashed Connection 2

Connection 1

Time
Packet Lifetime T
• A Delayed duplicate packet of connection 1 can create a confusion for
connection 2
What We Ideally Want? Either …

Conn 2

Sequence Numbers
Conn 1 initialized
crashed

Connection 2

Connection 1

Time
Packet Lifetime T
What We Ideally Want? Or …
Conn 2
initialized

Connection 2

Sequence Numbers
Conn 1
crashed

Connection 1

Time
Packet Lifetime T
Connection Establishment – Handling Delayed Duplicates
• Receiver receives two segments having the
same sequence number within a duration T
– One packet must be the duplicate
– The receiver discards the duplicate
packets.

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Connection Establishment – Handling Delayed Duplicates

• For a crashed device, the transport entity


remains idle for a duration T after recovery,
to ensure that all packets from the previous
connection are dead – not a good
solution

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Connection Establishment – Handling Delayed Duplicates

• Adjust the initial sequence numbers


properly - A host does not restart with
a sequence number in the forbidden
region, based on the sequence number
it used before crash and the time
duration T.

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Packet Sequence Numbers are Out of the Forbidden Region

Two possible source of problems


1. A host sends too much data too
fast on a newly opened
connection

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Packet Sequence Numbers are Out of the Forbidden Region

Two possible source of problems


2. The data rate is too slow that
the sequence number for a
previous connection enters the
forbidden region for the next
connection

Source: Computer Networks (5th Edition) by


Tanenbaum, Wetherell
Adjusting the Sending Rate based on Sequence Numbers
• The maximum data rate on any connection is one segment per clock tick
– Clock ticks (inter-packet transmission duration) is adjusted based on
the sequences acknowledged – ensure that no two packets are
there in the network with same sequence number
– We call this mechanism as self-clocking (used in TCP)
– Ensures that the sequence numbers do not warp around too quickly
(RFC 1323)
Adjusting the Sending Rate based on Sequence Numbers

• We do not remember sequence number at the receiver: Use a three


way handshake to ensure that the connection request is not a repetition
of an old connection request
– The individual peers validate their own sequence number by looking
at the acknowledgement (ACK)
– Positive synchronization among the sender and the receiver
Three Way Handshake
• By looking at the ACK, Host 1 ensures
that Sequence number x does not
belong to the forbidden region of any
previously established connection

• By looking at the ACK in DATA, Host 2


ensures that sequence number y does
not belong to the forbidden region of
Source: Computer Networks (5th Edition) by Tanenbaum,
any previously established connection
Wetherell
CONNECTION REQUEST is a Delayed Duplicate

Source: Computer
Networks (5th Edition) by
Tanenbaum, Wetherell
CONNECTION REQUEST and ACK both are Delayed Duplicates

Source: Computer Networks


(5th Edition) by Tanenbaum,
Wetherell
Connection Release – Asymmetric Release
• When one party hangs up, the
connection is broken

• This may results in data loss

Source: Computer
Networks (5th Edition) by
Tanenbaum, Wetherell
Connection Release – Symmetric Release
• Treats the connection as two separate unidirectional connections and requires
each one to be released separately

• Does the job when each process has a fixed amount of data to send and clearly
knows when it has sent it.

• What can be a protocol for this?


– Host 1: “I am done”
– Host 2: ”I am done too”

• Does this protocol work good always?


The Two Army Problem
Source: Computer
Networks (5th
Edition) by
Tanenbaum,
Wetherell

Let every party take


independent
No protocol exists to solve this decisions
Connection Release

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
Connection Release – Final ACK Lost

Source: Computer Networks (5th


Edition) by Tanenbaum,
Wetherell
Connection Release – Response Lost

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
Connection Release – Response Lost and Subsequent DRs Lost

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
23
COMPUTER NETWORKS AND
INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR

1
Transport Layer - III (Connection II)
Application Application
Connection
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Initial Sequence Number during Connection Establishment
Conn 2
initialized

Sequence Numbers
Conn 1
crashed Connection 2

Connection 1

Time
Packet Lifetime T
• A Delayed duplicate packet of connection 1 can create a confusion for
connection 2
What We Ideally Want? Either …

Conn 2

Sequence Numbers
Conn 1 initialized
crashed

Connection 2

Connection 1

Time
Packet Lifetime T
What We Ideally Want? Or …
Conn 2
initialized

Connection 2

Sequence Numbers
Conn 1
crashed

Connection 1

Time
Packet Lifetime T
Connection Establishment – Handling Delayed Duplicates
• Receiver receives two segments having the
same sequence number within a duration T
– One packet must be the duplicate
– The receiver discards the duplicate
packets.

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Connection Establishment – Handling Delayed Duplicates

• For a crashed device, the transport entity


remains idle for a duration T after recovery,
to ensure that all packets from the previous
connection are dead – not a good
solution

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Connection Establishment – Handling Delayed Duplicates

• Adjust the initial sequence numbers


properly - A host does not restart with
a sequence number in the forbidden
region, based on the sequence number
it used before crash and the time
duration T.

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Packet Sequence Numbers are Out of the Forbidden Region

Two possible source of problems


1. A host sends too much data too
fast on a newly opened
connection

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell


Packet Sequence Numbers are Out of the Forbidden Region

Two possible source of problems


2. The data rate is too slow that
the sequence number for a
previous connection enters the
forbidden region for the next
connection

Source: Computer Networks (5th Edition) by


Tanenbaum, Wetherell
Adjusting the Sending Rate based on Sequence Numbers
• The maximum data rate on any connection is one segment per clock tick
– Clock ticks (inter-packet transmission duration) is adjusted based on
the sequences acknowledged – ensure that no two packets are
there in the network with same sequence number
– We call this mechanism as self-clocking (used in TCP)
– Ensures that the sequence numbers do not warp around too quickly
(RFC 1323)
Adjusting the Sending Rate based on Sequence Numbers

• We do not remember sequence number at the receiver: Use a three


way handshake to ensure that the connection request is not a repetition
of an old connection request
– The individual peers validate their own sequence number by looking
at the acknowledgement (ACK)
– Positive synchronization among the sender and the receiver
Three Way Handshake
• By looking at the ACK, Host 1 ensures
that Sequence number x does not
belong to the forbidden region of any
previously established connection

• By looking at the ACK in DATA, Host 2


ensures that sequence number y does
not belong to the forbidden region of
Source: Computer Networks (5th Edition) by Tanenbaum,
any previously established connection
Wetherell
CONNECTION REQUEST is a Delayed Duplicate

Source: Computer
Networks (5th Edition) by
Tanenbaum, Wetherell
CONNECTION REQUEST and ACK both are Delayed Duplicates

Source: Computer Networks


(5th Edition) by Tanenbaum,
Wetherell
Connection Release – Asymmetric Release
• When one party hangs up, the
connection is broken

• This may results in data loss

Source: Computer
Networks (5th Edition) by
Tanenbaum, Wetherell
Connection Release – Symmetric Release
• Treats the connection as two separate unidirectional connections and requires
each one to be released separately

• Does the job when each process has a fixed amount of data to send and clearly
knows when it has sent it.

• What can be a protocol for this?


– Host 1: “I am done”
– Host 2: ”I am done too”

• Does this protocol work good always?


The Two Army Problem
Source: Computer
Networks (5th
Edition) by
Tanenbaum,
Wetherell

Let every party take


independent
No protocol exists to solve this decisions
Connection Release

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
Connection Release – Final ACK Lost

Source: Computer Networks (5th


Edition) by Tanenbaum,
Wetherell
Connection Release – Response Lost

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
Connection Release – Response Lost and Subsequent DRs Lost

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
23
COMPUTER NETWORKS AND
INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR

1
Transport Layer - V (Sliding Window Protocols)
Application Application
Flow Control & Reliable Data Delivery
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Stop and Wait versus Sliding Window (Pipelined)

Source: Computer Networks,


Kurose, Ross
Sliding Window Protocols
• Each outbound segment contains a sequence number – from 0 to some
maximum (2n-1 for a n bit sequence number)

• The sender maintains a set of sequence numbers corresponding to frames


it is permitted to send (sending window)

• The receiver maintains a set of frames it is permitted to accept (receiving


window)
Sliding Window Protocols – Sending Window and Receiving Window

Source:
http://ironbark.xtelco.com.au/subjects/DC/
lectures/13/
Sliding Window for a 3 bit Sequence Number

Source: Computer Networks (5th


Edition) by Tanenbaum, Wetherell
Sliding Window Protocols in Noisy Channels
• A timeout occurs if a segment (or the acknowledgment) gets lost

• How does the flow and error control protocol handle a timeout?

• Go Back N ARQ: If segment N is lost, all the segments from segment 0 (start of
the sliding window) to segment N are retransmitted

• Selective Repeat (SR) ARQ: Only the lost packets are selectively retransmitted
– Negative Acknowledgement (NAK) or Selective Acknowledgements
(SACK): Informs the sender about which packets need to be retransmitted
(not received by the receiver)
Go Back N ARQ – Sender Window Control

Source: Computer Networks,


Kurose, Ross
Go Back N ARQ

Source
https://www.tutorialspoint.com/data_co
mmunication_computer_network/data_li
nk_control_and_protocols.htm
Go Back N ARQ – Sender

Source: Computer Networks,


Kurose, Ross
Go Back N ARQ – Receiver

Source: Computer Networks,


Kurose, Ross
Go Back N ARQ – A Bound on Window Size
• Outstanding Frames – Frames that have been transmitted, but not yet
acknowledged

• Maximum Sequence Number (MAX_SEQ): MAX_SEQ+1 distinct sequence


numbers are there
– 0,1,…,MAX_SEQ

• Maximum Number of Outstanding Frames (=Window Size): MAX_SEQ

• Example: Sequence Numbers (0,1,2,…,7) – 3 bit sequence numbers, number of


outstanding frames = 7 (Not 8)
Go Back N ARQ (MAX_SEQ = 3, Window Size = 4)
0
0 1 2 3 0 0 1 2 3 0

0 1 2 3 0 1
0 1 2 3 0

0 1 2 3 0 2
0 1 2 3 0
3
0 1 2 3 0 0 1 2 3 0

0 1 2 3 0 0
0 1 2 3 0
Timeout
Go Back N ARQ (MAX_SEQ = 3, Window Size = 3)
0
0 1 2 3 0 0 1 2 3 0

0 1 2 3 0 1
0 1 2 3 0

0 1 2 3 0 2
0 1 2 3 0
Timeout
0
0 1 2 3 0 0 1 2 3 0

Discards the wrong


frame correctly
Selective Repeat (SR) – Window Control

Source: Computer Networks,


Kurose, Ross
Selective Repeat ARQ

Source: Computer Networks,


Tanenbaum
Selective Repeat – A Bound on Window Size

• Maximum Sequence Number (MAX_SEQ): MAX_SEQ+1 distinct sequence


numbers are there
– 0,1,…,MAX_SEQ

• Maximum Number of Outstanding Frames ( =Window Size ): (MAX_SEQ+1)/2

• Example: Sequence Numbers (0,1,2,…,7) – 3 bit sequence numbers, number of


outstanding frames (window size) = 4
Selective Repeat (MAX_SEQ = 3, Window Size = 3)
0
0 1 2 3 0 0 1 2 3 0 1 2

0 1 2 3 0 1
0 1 2 3 0 1 2

0 1 2 3 0 2
0 1 2 3 0 1 2
Timeout
0
0 1 2 3 0 0 1 2 3 0 1 2
Selective Repeat (MAX_SEQ = 3, Window Size = 3)

0
0 1 2 3 0 0 1 2 3 0 1 2

0 1 2 3 0 1
0 1 2 3 0 1 2
Timeout
0 1 2 3 0 0
0 1 2 3 0 1 2

Discards the wrong frame correctly


20

You might also like