SlideShare a Scribd company logo
Chapter 3
Transport Layer
Computer Networking:
A Top Down Approach,

4th edition.
Jim Kurose, Keith Ross
Addison-Wesley
Chapter 3: Transport Layer
Our goals:
 Understand principles
behind transport layer
services:





Multiplexing/De-multiplexing
Reliable data transfer
Congestion control
Flow Control

 Learn about transport

layer protocols in the
Internet:







UDP: connectionless
transport
TCP: connection-oriented
transport
TCP Reliability
TCP congestion control
TCP Flow Control
Transport Services and Protocols
 Transport layer protocols provide

logical communication between app

processes running on different hosts
 From application’s perspective as
if the host running the process
are directly connected
 Transport protocols run in end
systems
 Not in routers
 Sender side: Breaks app
messages into segments, passes
to network layer
 Receiver side: Reassembles
segments into messages, passes
to application layer
 More than one transport protocol
available to applications
 Internet: TCP and UDP

application
transport
network
data link
physical

application
transport
network
data link
physical
Transport vs. Network layer
Network layer: logical communication between hosts
 Transport layer: logical communication between


processes

Household Analogy:


12 kids sending letters to 12 kids

 processes = kids
 app messages = letters in envelopes
 hosts = houses
 transport protocol = Ann and Bill

 network-layer protocol = postal service
 Transport layer relies on Network layer
Internet Transport Layer Protocols
 Internet Protocol (IP)

Best effort delivery service
 No guarantees for segment delivery
 No guarantees for orderly delivery of data
 IP is unreliable service
Extending Host-to-Host delivery to process-to-process delivery.
 Transport layer Multiplexing and De-multiplexing
UDP and TCP also provide integrity checking by including error
detection field in their segment headers.
UDP services

Process to process data delivery

Error checking
TCP Reliable data Transfer
 Congestion Control, sequence numbers, acknowledgements and
timers







Multiplexing/De-Multiplexing
 Every process has a socket which allows

Data to pass from the network to the process

Data to pass from the process to the network
 Receiving host directs an incoming transport layer

segment to appropriate socket.


Uses set of fields in the transport layer segments

 Delivering data in the transport layer segment to the

correct socket is called de-multiplexing.
 Gathering data chunks at the source host from
different sockets ,appending header information and
passing to the network layer is called multiplexing
 Household analogy
Multiplexing/De-multiplexing
Demultiplexing at rcv host:
delivering received segments
to correct socket
= socket

= process

application P3

P1
P1
application

transport

transport

network

network

link

physical

P4

application

link

physical

Multiplexing at send host:
gathering data from multiple
sockets, enveloping data with
header (later used for
demultiplexing)

host 1

P2

transport
network
link
physical

host 2

host 3
How De-multiplexing works
 Sockets have unique

identifier
 Each segment has special
field that indicate the socket
to which the segment is to be
delivered
 Source port number
 Destination port number
 Port is a 16 bit number
0 to 65535
0 to 1023 are well
known port numbers
and are reserved

32 bits
Source Port #

Dest Port #

Other Header Fields

Application
Data
(message)
Transport Layer Segment Format
Connectionless Transport:UDP








Internet transport protocol RFC 768
UDP does just about as little as a transport layer protocol can
do
Multiplexing/De-multiplexing
Error checking
“Best Effort” service, UDP segments may be:
 lost
 delivered out of order to applications

Connectionless:



No handshaking between UDP sender, receiver
Each UDP segment handled independently of others
Connectionless Transport:UDP
Why is there a UDP?
 No connection establishment



TCP uses a three way handshake
UDP has no delay to establish a connection
 DNS uses UDP

 No connection state at sender, receiver




TCP maintains connection state
 Congestion control parameters, sequence numbers etc.
UDP maintains no connection state
 Server can support many more active clients with UDP than over TCP

 Small segment header




20 bytes of header in TCP
Only 8 bytes of header in UDP

 No congestion control


UDP can blast away as fast as desired
UDP: Segment Structure
 The application data

occupies the data field of
the UDP segment.
 UDP header has four fields
 Each of two bytes
 Checksum
 Used by receiving host
to check for errors in
the segment
 Length
 Length of the UDP
segment

Length, in
bytes of
UDP
segment,
including
header

source port #

dest port #

length

checksum

Application
data
(message)
UDP segment format
Connectionless (UDP) De-multiplexing

P2

SP: 6428

SP: 6428
DP: 9157

client
IP: A

P1
P1

P3

SP: 9157
DP: 6428

DP: 5775

server
IP: C
SP provides “return address”

SP: 5775
DP: 6428

Client
IP:B
UDP Checksum
Checksum is used to determine whether bits within the UDP
segment have been altered e.g. noise in the link.

Sender:
 Treat segment contents

as sequence of 16-bit
word
 Checksum: 1’s complement
of the sum of all the 16bit words.
 Sender puts checksum
value into UDP checksum
field

Receiver:
 All segments are added and

than sum is added with
sender's checksum.
 If no errors are introduced
into the packet, then clearly
the sum at the receiver will
be all 1’s.
 If receiver side checksum
contains any 0 then, error is
detected and the packet is
discarded.
Checksum Example
(16 bits segment) 0110011001100110
0101010101010101
0000111100001111
The sum of first of these 16-bits integer is:
0110011001100110
0101010101010101
1011101110111011
Adding the third one to the above sum gives
1011101110111011
0000111100001111
1100101011001010 (sum of all segments)
The checksum at sender side is : 0011010100110101 (1’s
complement).
 Now at the receiver side, again all segments are added and
sum is added with sender's checksum.
 If no error than check of receiver would be :
1111111111111111
Checksum Example
 Note


When adding numbers, a carryout from the
most significant bit needs to be added to the
result

 Example: Add two 16-bit words

1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Home Assignment

 Difference between UDP and UDP Lite?
Principles of Reliable Data Transfer
• Important in application, transport, link layers
• Top-10 list of important networking topics!
Principles of Reliable Data Transfer (rdt)
• Important in application, transport, link layers
• Top-10 list of important networking topics!
Principles of Reliable Data Transfer
• Important in application, transport, link layers
• Top-10 list of important networking topics!
Reliable Data Transfer: Getting Started
rdt_send(): called from
above, (e.g., by app.). Passed data to
deliver to receiver upper layer

send
side

udt_send(): called by rdt
protocol, to transfer packet over
unreliable channel to receiver

deliver_data(): called by rdt
to deliver data to upper layer

receive
side

rdt_rcv(): called when packet
arrives on rcv-side of channel
Reliable Data Transfer: Getting Started
We’ll:
• Incrementally develop sender, receiver sides of
reliable data transfer protocol (rdt)
• Consider only unidirectional data transfer
– but control info will flow on both directions!

• Use Finite State Machines (FSM) to specify sender,
receiver
event causing state transition
actions taken on state transition
state: When in this “state”
next state uniquely
determined by next
event

state
1

event
actions

state
2
Rdt1.0: Reliable Data Transfer over a Perfectly
Reliable Channel
• Underlying channel perfectly reliable
– no bit errors
– no loss of packets

• Separate FSMs for sender, receiver:
– sender sends data into underlying channel
– receiver read data from underlying channel

• The initial state of the FSM is indicated by the dashed line
Wait for
call from
above

rdt_send(data)
packet =make_pkt(data)
udt_send(packet)

Sender

Wait for
call from
below

rdt_rcv(packet)
extract (packet,data)
deliver_data(data)

Receiver

Note:Perfectly reliable channel no need for feedback
Rdt2.0: Channel with Bit Errors
• More realistic model
– Underlying channel may flip bits in packet

• How people deal with such a situation
– OK (positive acknowledgment)
– Please repeat that (negative acknowledgements)
– Acknowledgements (ACKs): Receiver explicitly tells sender that pkt
received OK
– Negative acknowledgements (NAKs): Receiver explicitly tells sender
that pkt had errors
– Sender retransmits pkt on receipt of NAK

• These control messages let the receiver know
– What has been received in error and requires repetition

• Automatic Repeat reQuest (ARQ) protocols.
Rdt2.0: Channel with Bit Errors
Three capabilities are required in ARQ to handle the presence of bit
errors.
• Error Detection:
– Needed to allow the receiver to detect bit errors
– Checksum field in the header
• Receiver Feed Back
– Receiver provided explicit feedback
– ACK
– NAK
• Retransmission
– A packet that is received in error will be retransmitted
• New mechanisms in rdt2.0 (beyond rdt1.0):
– Error detection
– Receiver feedback: Control msgs (ACK,NAK) Rcvr->Sender
Rdt2.0: FSM Specification
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for
call from
above

Wait for
ACK or
NAK

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

receiver
rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for call
from below

sender
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Rdt2.0: Operation with No Errors
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)

Wait for call
from above

Wait for
ACK or
NAK

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for call
from below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Rdt2.0: error scenario
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for

Wait for call
from above

ACK or
NAK

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for call
from below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Rdt2.0
• rdt2.0 is a stop and wait protocol
– Sender sends one packet, then
waits for receiver response

• rdt2.0 has a fatal flaw
• What happens if ACK/NAK get
corrupted?
–

•

Add checksum bits to ACK/NAK

How the protocol should recover from
errors in ACK/NAK?
– Retransmission on receipt of a
corrupt ACK/NAK
– Retransmission causes duplicates

– Receiver does not know whether
ACK or NAK it sent was received
correctly
– Receiver does not know a priori
whether an arriving packet
contains new data or is a
retransmission

Handling Duplicates:
• Sender retransmits current
packet if ACK/NAK garbled
• Sender adds sequence number
to each packet
• Receiver discards (doesn’t
deliver up) duplicate packet

More Related Content

PDF
TCP - Transmission Control Protocol
PPT
Transport Layer
PPTX
Transport layer protocol
PPT
the transport layer
PPT
Transport services
PDF
Lec 12(Transport Layer)
PDF
Lec 2(intoduction of computer networkes)
PPT
Transport protocols
TCP - Transmission Control Protocol
Transport Layer
Transport layer protocol
the transport layer
Transport services
Lec 12(Transport Layer)
Lec 2(intoduction of computer networkes)
Transport protocols

What's hot (20)

PDF
TCP Vs UDP
PDF
Transport layer services
PPT
Transportlayer tanenbaum
PPT
Tcp Udp
PDF
TCP - IP Presentation
PPT
Transport layer (computer networks)
PPTX
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
PPTX
A day in the life of a Web Request
PPTX
Week9 lec1
PPTX
TCP/IP 3-way Handshake
PDF
Transport layer
DOC
User datagram protocol
PDF
Cs556 section3
PPTX
Transport Layer Part 1
PPTX
TCP- Transmission Control Protocol
PDF
Transport Protocols
PPTX
PPTX
transport layer
PPT
transport layer protocols
TCP Vs UDP
Transport layer services
Transportlayer tanenbaum
Tcp Udp
TCP - IP Presentation
Transport layer (computer networks)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
A day in the life of a Web Request
Week9 lec1
TCP/IP 3-way Handshake
Transport layer
User datagram protocol
Cs556 section3
Transport Layer Part 1
TCP- Transmission Control Protocol
Transport Protocols
transport layer
transport layer protocols
Ad

Viewers also liked (8)

PPTX
Multiplexer
PPT
7 multiplexing
PPT
Multiplexing
PPTX
Multiplexer & de multiplexer
PPT
Multiplexing
PPTX
multiplexer and d-multiplexer
PPT
User datagram protocol
PPT
Multiplexers & Demultiplexers
Multiplexer
7 multiplexing
Multiplexing
Multiplexer & de multiplexer
Multiplexing
multiplexer and d-multiplexer
User datagram protocol
Multiplexers & Demultiplexers
Ad

Similar to Week4 lec1-bscs1 (20)

PPTX
3.1 Transport Layer Presentationsss.pptx
PPTX
transport.pptx
PPTX
Computer network transport layer MODUL 2.pptx
PPTX
COE332-Ch03d.pptx
PPTX
CNS_Module-2-ppt.pptx
PPTX
Lec6
PPTX
Lecture 15 Transport Layer Part02 (1).pptx
PDF
Chapter3 transport layer
PPT
Chapter3 transport
PDF
3. transport layer
PDF
Computer Network notes Transport layer.pdf
PPT
Chapter_3_V6.01.ppt
PPT
computer network having transport layer.ppt
PPT
Chapter_3_V7.01.ppt
PDF
Chapter 3 - Computer Networking a top-down Approach 7th
PDF
Net_Chapter_3-software-computer network.pdf
PPT
Chapter3.ppt hu yyttujhgft uhhgfrghbhhgghhjhy
PPTX
introducton to network securityand data communiationa
PPT
Chapter 3 Transport Layer computer network
PPT
computer Networks Transport Layer .ppt
3.1 Transport Layer Presentationsss.pptx
transport.pptx
Computer network transport layer MODUL 2.pptx
COE332-Ch03d.pptx
CNS_Module-2-ppt.pptx
Lec6
Lecture 15 Transport Layer Part02 (1).pptx
Chapter3 transport layer
Chapter3 transport
3. transport layer
Computer Network notes Transport layer.pdf
Chapter_3_V6.01.ppt
computer network having transport layer.ppt
Chapter_3_V7.01.ppt
Chapter 3 - Computer Networking a top-down Approach 7th
Net_Chapter_3-software-computer network.pdf
Chapter3.ppt hu yyttujhgft uhhgfrghbhhgghhjhy
introducton to network securityand data communiationa
Chapter 3 Transport Layer computer network
computer Networks Transport Layer .ppt

More from syedhaiderraza (20)

PPTX
Week16 lec1
PPTX
Week15 lec1
PPTX
Week14 lec2
PPTX
Week14 lec1
PPTX
Week13 lec2
PPTX
Week13 lec1
PPTX
Week11 lec2
PPTX
Week11 lec1
PPTX
Week10 lec1
PPTX
Week8 lec2-bscs1
PPTX
Week8 lec1-bscs1
PPTX
Week5 lec3-bscs1
PPTX
Week5 lec2-bscs1
PPT
Week5 lec1-bscs1
PPTX
Week4 lec2-bscs1
PPTX
Week3 lec3-bscs1
PPTX
Week3 lec 2
PPTX
Week3 lec 1
PPTX
Week2 lec3-bscs1
PPTX
Week2 lec2-bscs1
Week16 lec1
Week15 lec1
Week14 lec2
Week14 lec1
Week13 lec2
Week13 lec1
Week11 lec2
Week11 lec1
Week10 lec1
Week8 lec2-bscs1
Week8 lec1-bscs1
Week5 lec3-bscs1
Week5 lec2-bscs1
Week5 lec1-bscs1
Week4 lec2-bscs1
Week3 lec3-bscs1
Week3 lec 2
Week3 lec 1
Week2 lec3-bscs1
Week2 lec2-bscs1

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Pharma ospi slides which help in ospi learning
PPTX
GDM (1) (1).pptx small presentation for students
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
master seminar digital applications in india
PPTX
Cell Types and Its function , kingdom of life
PDF
Sports Quiz easy sports quiz sports quiz
Module 4: Burden of Disease Tutorial Slides S2 2025
Pharma ospi slides which help in ospi learning
GDM (1) (1).pptx small presentation for students
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
O7-L3 Supply Chain Operations - ICLT Program
Renaissance Architecture: A Journey from Faith to Humanism
STATICS OF THE RIGID BODIES Hibbelers.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Cell Structure & Organelles in detailed.
TR - Agricultural Crops Production NC III.pdf
Insiders guide to clinical Medicine.pdf
master seminar digital applications in india
Cell Types and Its function , kingdom of life
Sports Quiz easy sports quiz sports quiz

Week4 lec1-bscs1

  • 1. Chapter 3 Transport Layer Computer Networking: A Top Down Approach, 4th edition. Jim Kurose, Keith Ross Addison-Wesley
  • 2. Chapter 3: Transport Layer Our goals:  Understand principles behind transport layer services:     Multiplexing/De-multiplexing Reliable data transfer Congestion control Flow Control  Learn about transport layer protocols in the Internet:      UDP: connectionless transport TCP: connection-oriented transport TCP Reliability TCP congestion control TCP Flow Control
  • 3. Transport Services and Protocols  Transport layer protocols provide logical communication between app processes running on different hosts  From application’s perspective as if the host running the process are directly connected  Transport protocols run in end systems  Not in routers  Sender side: Breaks app messages into segments, passes to network layer  Receiver side: Reassembles segments into messages, passes to application layer  More than one transport protocol available to applications  Internet: TCP and UDP application transport network data link physical application transport network data link physical
  • 4. Transport vs. Network layer Network layer: logical communication between hosts  Transport layer: logical communication between  processes Household Analogy:  12 kids sending letters to 12 kids  processes = kids  app messages = letters in envelopes  hosts = houses  transport protocol = Ann and Bill  network-layer protocol = postal service  Transport layer relies on Network layer
  • 5. Internet Transport Layer Protocols  Internet Protocol (IP) Best effort delivery service  No guarantees for segment delivery  No guarantees for orderly delivery of data  IP is unreliable service Extending Host-to-Host delivery to process-to-process delivery.  Transport layer Multiplexing and De-multiplexing UDP and TCP also provide integrity checking by including error detection field in their segment headers. UDP services  Process to process data delivery  Error checking TCP Reliable data Transfer  Congestion Control, sequence numbers, acknowledgements and timers     
  • 6. Multiplexing/De-Multiplexing  Every process has a socket which allows  Data to pass from the network to the process  Data to pass from the process to the network  Receiving host directs an incoming transport layer segment to appropriate socket.  Uses set of fields in the transport layer segments  Delivering data in the transport layer segment to the correct socket is called de-multiplexing.  Gathering data chunks at the source host from different sockets ,appending header information and passing to the network layer is called multiplexing  Household analogy
  • 7. Multiplexing/De-multiplexing Demultiplexing at rcv host: delivering received segments to correct socket = socket = process application P3 P1 P1 application transport transport network network link physical P4 application link physical Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) host 1 P2 transport network link physical host 2 host 3
  • 8. How De-multiplexing works  Sockets have unique identifier  Each segment has special field that indicate the socket to which the segment is to be delivered  Source port number  Destination port number  Port is a 16 bit number 0 to 65535 0 to 1023 are well known port numbers and are reserved 32 bits Source Port # Dest Port # Other Header Fields Application Data (message) Transport Layer Segment Format
  • 9. Connectionless Transport:UDP       Internet transport protocol RFC 768 UDP does just about as little as a transport layer protocol can do Multiplexing/De-multiplexing Error checking “Best Effort” service, UDP segments may be:  lost  delivered out of order to applications Connectionless:   No handshaking between UDP sender, receiver Each UDP segment handled independently of others
  • 10. Connectionless Transport:UDP Why is there a UDP?  No connection establishment   TCP uses a three way handshake UDP has no delay to establish a connection  DNS uses UDP  No connection state at sender, receiver   TCP maintains connection state  Congestion control parameters, sequence numbers etc. UDP maintains no connection state  Server can support many more active clients with UDP than over TCP  Small segment header   20 bytes of header in TCP Only 8 bytes of header in UDP  No congestion control  UDP can blast away as fast as desired
  • 11. UDP: Segment Structure  The application data occupies the data field of the UDP segment.  UDP header has four fields  Each of two bytes  Checksum  Used by receiving host to check for errors in the segment  Length  Length of the UDP segment Length, in bytes of UDP segment, including header source port # dest port # length checksum Application data (message) UDP segment format
  • 12. Connectionless (UDP) De-multiplexing P2 SP: 6428 SP: 6428 DP: 9157 client IP: A P1 P1 P3 SP: 9157 DP: 6428 DP: 5775 server IP: C SP provides “return address” SP: 5775 DP: 6428 Client IP:B
  • 13. UDP Checksum Checksum is used to determine whether bits within the UDP segment have been altered e.g. noise in the link. Sender:  Treat segment contents as sequence of 16-bit word  Checksum: 1’s complement of the sum of all the 16bit words.  Sender puts checksum value into UDP checksum field Receiver:  All segments are added and than sum is added with sender's checksum.  If no errors are introduced into the packet, then clearly the sum at the receiver will be all 1’s.  If receiver side checksum contains any 0 then, error is detected and the packet is discarded.
  • 14. Checksum Example (16 bits segment) 0110011001100110 0101010101010101 0000111100001111 The sum of first of these 16-bits integer is: 0110011001100110 0101010101010101 1011101110111011 Adding the third one to the above sum gives 1011101110111011 0000111100001111 1100101011001010 (sum of all segments) The checksum at sender side is : 0011010100110101 (1’s complement).  Now at the receiver side, again all segments are added and sum is added with sender's checksum.  If no error than check of receiver would be : 1111111111111111
  • 15. Checksum Example  Note  When adding numbers, a carryout from the most significant bit needs to be added to the result  Example: Add two 16-bit words 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
  • 16. Home Assignment  Difference between UDP and UDP Lite?
  • 17. Principles of Reliable Data Transfer • Important in application, transport, link layers • Top-10 list of important networking topics!
  • 18. Principles of Reliable Data Transfer (rdt) • Important in application, transport, link layers • Top-10 list of important networking topics!
  • 19. Principles of Reliable Data Transfer • Important in application, transport, link layers • Top-10 list of important networking topics!
  • 20. Reliable Data Transfer: Getting Started rdt_send(): called from above, (e.g., by app.). Passed data to deliver to receiver upper layer send side udt_send(): called by rdt protocol, to transfer packet over unreliable channel to receiver deliver_data(): called by rdt to deliver data to upper layer receive side rdt_rcv(): called when packet arrives on rcv-side of channel
  • 21. Reliable Data Transfer: Getting Started We’ll: • Incrementally develop sender, receiver sides of reliable data transfer protocol (rdt) • Consider only unidirectional data transfer – but control info will flow on both directions! • Use Finite State Machines (FSM) to specify sender, receiver event causing state transition actions taken on state transition state: When in this “state” next state uniquely determined by next event state 1 event actions state 2
  • 22. Rdt1.0: Reliable Data Transfer over a Perfectly Reliable Channel • Underlying channel perfectly reliable – no bit errors – no loss of packets • Separate FSMs for sender, receiver: – sender sends data into underlying channel – receiver read data from underlying channel • The initial state of the FSM is indicated by the dashed line Wait for call from above rdt_send(data) packet =make_pkt(data) udt_send(packet) Sender Wait for call from below rdt_rcv(packet) extract (packet,data) deliver_data(data) Receiver Note:Perfectly reliable channel no need for feedback
  • 23. Rdt2.0: Channel with Bit Errors • More realistic model – Underlying channel may flip bits in packet • How people deal with such a situation – OK (positive acknowledgment) – Please repeat that (negative acknowledgements) – Acknowledgements (ACKs): Receiver explicitly tells sender that pkt received OK – Negative acknowledgements (NAKs): Receiver explicitly tells sender that pkt had errors – Sender retransmits pkt on receipt of NAK • These control messages let the receiver know – What has been received in error and requires repetition • Automatic Repeat reQuest (ARQ) protocols.
  • 24. Rdt2.0: Channel with Bit Errors Three capabilities are required in ARQ to handle the presence of bit errors. • Error Detection: – Needed to allow the receiver to detect bit errors – Checksum field in the header • Receiver Feed Back – Receiver provided explicit feedback – ACK – NAK • Retransmission – A packet that is received in error will be retransmitted • New mechanisms in rdt2.0 (beyond rdt1.0): – Error detection – Receiver feedback: Control msgs (ACK,NAK) Rcvr->Sender
  • 25. Rdt2.0: FSM Specification rdt_send(data) snkpkt = make_pkt(data, checksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && isNAK(rcvpkt) Wait for call from above Wait for ACK or NAK udt_send(sndpkt) rdt_rcv(rcvpkt) && isACK(rcvpkt) receiver rdt_rcv(rcvpkt) && corrupt(rcvpkt) udt_send(NAK) Wait for call from below sender rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) extract(rcvpkt,data) deliver_data(data) udt_send(ACK)
  • 26. Rdt2.0: Operation with No Errors rdt_send(data) snkpkt = make_pkt(data, checksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && isNAK(rcvpkt) Wait for call from above Wait for ACK or NAK udt_send(sndpkt) rdt_rcv(rcvpkt) && isACK(rcvpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt) udt_send(NAK) Wait for call from below rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) extract(rcvpkt,data) deliver_data(data) udt_send(ACK)
  • 27. Rdt2.0: error scenario rdt_send(data) snkpkt = make_pkt(data, checksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && isNAK(rcvpkt) Wait for Wait for call from above ACK or NAK udt_send(sndpkt) rdt_rcv(rcvpkt) && isACK(rcvpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt) udt_send(NAK) Wait for call from below rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) extract(rcvpkt,data) deliver_data(data) udt_send(ACK)
  • 28. Rdt2.0 • rdt2.0 is a stop and wait protocol – Sender sends one packet, then waits for receiver response • rdt2.0 has a fatal flaw • What happens if ACK/NAK get corrupted? – • Add checksum bits to ACK/NAK How the protocol should recover from errors in ACK/NAK? – Retransmission on receipt of a corrupt ACK/NAK – Retransmission causes duplicates – Receiver does not know whether ACK or NAK it sent was received correctly – Receiver does not know a priori whether an arriving packet contains new data or is a retransmission Handling Duplicates: • Sender retransmits current packet if ACK/NAK garbled • Sender adds sequence number to each packet • Receiver discards (doesn’t deliver up) duplicate packet