SlideShare une entreprise Scribd logo
1  sur  21
Chapter 3
Transport Layer

Computer Networking:
A Top Down Approach,

4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2007.
Pipelined Reliable Data Transfer Protocols
 Pipelining has the following consequences for

reliable data transfer
 Range of sequence numbers must be increased
 Sender and receiver sides may have to buffer
more than one packet.

 Two basic approaches towards pipeline error

recovery:

Go-Back-N, Selective Repeat
Go-Back-N (GBN)
Sender:
 Sender is allowed to transmit multiple packets without waiting

for an acknowledgement
 Constrained to a certain maximum number N.
 Base or send_base
 Sequence number of oldest unacknowledged packet
 Nextseqnum
 Sequence number of next packet to be sent
 The range of sequence numbers for transmitted but not
acknowledged packets can be viewed as a window of size N.
 This window slides forward as the protocol operates
Go-Back-N
GBN sender must respond to three types of events
 Invocation from above (rdt_send() is called):
 If window is full, returns data to upper layer
 Maintain synchronization mechanism
 Receipt of an ACK:
 ACK for packet with seq # n is taken as“Cumulative ACK”
 More shortly in receiver
 Time out event:
 Sender has timer for oldest unacknowledged packet
• If timer expires, retransmit all unacknowledged packets
Go-Back-N
Receiver:
 If a packet with seq # n is received correctly and is in
order


ACK is sent and data is delivered to upper layers

 For all other cases
 Receiver discards the packet and resends ACK for most
recently received in order packet
 Packets are delivered one at a time to upper layers
 If a packet k has been received and delivered, then all
packets with seq # lower than k have also been delivered.
r Receiver discards out of order packets
 No receiver buffering
 Need only remember expectedseqnum
GBN in
action

http://www.eecis.udel.edu/~amer/450/TransportApplets/GBN/GBNindex.html
Selective Repeat
 Selective Repeat protocol avoid unnecessary

retransmissions
o Sender only retransmits packets that were lost or are
in error
o A window size N is used to limit the no of outstanding
unacknowledged packets in the pipeline
Selective Repeat
Sender:
 Data received from upper layers
o If window is full, returns data to upper layer
o Maintain synchronization mechanism
 Timeout
o Each packet has its own timer
o Single packet is retransmitted on timeout
 ACK received:
o Sender marked packet as received provided its in the
window
o Packets sequence no is equal to send_base,
• The window base is moved forward to the unacknowledged
packet
Selective Repeat
Receiver:
 Packets with sequence no in the window
 Selective ACK is sent to the sender whether or not it is
in order.
 Out-of-order: buffer but send ACK for that packet
 Deliver base plus buffered packets
 Packets with sequence number below the window

base


An ACK must be generated even though the packet has
already been acknowledged by the receiver
Selective Repeat in Action

http://www.eecis.udel.edu/~amer/450/TransportApplets/SR/SRindex.html
Selective Repeat:
Dilemma
 Finite range of sequence

numbers

Example:
 Seq #‟s: 0, 1, 2, 3
 Window size=3
 Receiver sees no difference in

two scenarios!
 Incorrectly passes duplicate
data as new in (a)
 Window size of one less than
the sequence number space
does not work
 Window size must be less than
or equal to half the size of
sequence no. space
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581
 Connection Oriented

Handshake
Send segments to each other to establish
parameters of ensuing data transfer

 Runs on the end systems

 TCP connection is point to point (single sender

and receiver)

Does not support multicast (one sender many
receivers)

 TCP send buffer

TCP grab a chunk of data from this buffer
 MSS (Maximum Segment Size)


The maximum amount of data that can be
grabbed and placed in a segment

 TCP receive buffer
TCP Segment Structure
URG: urgent data

ACK?
PSH?
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Same as in UDP
To negotiate maximum
segment size etc.

source port #
dest port #
sequence number
acknowledgement number

head not
len used

UAP R S F Receive window
Urg data pointer
checksum

Options (variable length)

Used in
implementing
a reliable
data transfer
Used for
flow control

application
data
(variable length)

Find more out about OPTONS? (SEE RFC 853, RFC 1323)
TCP Sequence Numbers and ACKs
Sequence Numbers:
 Sequence nos. are over the stream of transmitted
bytes and not over the series of transmitted
segments
 Sequence no. is the byte stream “number” of first
byte in segment‟s data
 Example:









Host A wants to send data to Host B
File consisting of 500,000 bytes, MSS is 1,000 bytes
First byte of stream is numbered zero
TCP constructs 500 segments out of data stream
First segment gets sequence number --- 0
Second segment gets sequence number----1000
Third segment gets sequence number------2000 and so on
TCP Sequence Numbers
 Imagine a TCP connection is transferring a file of

6000 bytes. The first byte is numbered 10010. What
are the sequence numbers for each segment if data is
sent in five segments with the first four segments
carrying 1,000 bytes and the last segment carrying
2,000 bytes?
TCP Sequence Numbers
Solution:
The following shows the sequence number for
each segment:
Segment 1  10,010

(10,010 to 11,009)

Segment 2  11,010

(11,010 to 12,009)

Segment 3  12,010

(12,010 to 13,009)

Segment 4  13,010

(13,010 to 14,009)

Segment 5  14,010

(14,010 to 16,009)
TCP ACKs
Acknowledgement Numbers:


The acknowledgement no that hosts A puts in its segment is
the sequence no of the next byte host A is expecting from
host B.

 Example
 Host A receives all bytes numbered 0 through 535 from B
 Host A puts 536 in the acknowledgment number field of the
segment it sends to B
 TCP acknowledges bytes up to first missing bytes in the stream
 Cumulative Acknowledgement
 How receiver handles out-of-order segments?
 TCP RFCs do not impose any rules
Two choices
o The receiver discards out of order segments
o Keeps out of order bytes and waits for missing bytes to fill
TCP Sequence Numbers and ACKs
Example:
 Host A sends a
character to Host B,
which echoes it back to
Host A.
 Starting Sequence no
for client and server are
42 and 79.
Piggybacking:
 Acknowledgement of
client to server data is
carried by segment of
server to client data

Host A

Host B

User
types
„C‟

host ACKs
receipt
of echoed
„C‟

host ACKs
receipt of
„C‟, echoes
back „C‟
Piggybacked

time
TCP Flow Control
 Eliminate the possibility of sender overflowing
receiver‟s buffer by transmitting too much, too
fast.
 Sender maintains a variable receive window
– Gives the sender an idea of how much free space is
available at receiver
 Example
 Host A is sending a large file to host B
 Host B allocates a receive buffer and denotes size by
RcvBuffer
 LastByteRead
The number of the last byte read from buffer by
process in Host B
 LastByteRcvd:
The number of last byte that has been placed in buffer
at B
TCP Flow Control
 RcvWindow is set to the amount of spare room in the buffer
 RcvWindow= RcvBuffer - [LastByteRcvd - LastByteRead]

 Host B informs Host A about how much spare room it has in
the connection buffer.
 Places RcvWindow in the receive window field of every segment

 Host A keeps track of two variables
 LastByteSent and LastByteAcked
TCP Flow Control
 LastByteSent – LastByteAcked
– It is the amount of unacknowledged data that A has sent
into the connection

 LastByteSent – LastByteAcked

RcvWindow

– Keeping the unacknowledged data less than the value of
RcvWindow

 Suppose RcvWindow=0
– Host B advertises RcvWindow=0 to Host A
– Suppose Host B has nothing to send to host A
– TCP specification require Host A to send one byte of data
Persistence Timer? Home Assignment

Contenu connexe

Tendances

Distributed Video Streaming over Internet
Distributed Video Streaming over InternetDistributed Video Streaming over Internet
Distributed Video Streaming over Internet
Videoguy
 
Assignment cn tl
Assignment cn tlAssignment cn tl
Assignment cn tl
H K
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
Rishu Seth
 
3a data link layer continued
3a data link layer continued3a data link layer continued
3a data link layer continued
kavish dani
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
NYversity
 
Tcp congestion control
Tcp congestion controlTcp congestion control
Tcp congestion control
Abdo sayed
 

Tendances (20)

TCP Westwood
TCP WestwoodTCP Westwood
TCP Westwood
 
Module15: Sliding Windows Protocol and Error Control
Module15: Sliding Windows Protocol and Error Control Module15: Sliding Windows Protocol and Error Control
Module15: Sliding Windows Protocol and Error Control
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 
Cubic
CubicCubic
Cubic
 
Introduction to TCP
Introduction to TCPIntroduction to TCP
Introduction to TCP
 
Distributed Video Streaming over Internet
Distributed Video Streaming over InternetDistributed Video Streaming over Internet
Distributed Video Streaming over Internet
 
Assignment cn tl
Assignment cn tlAssignment cn tl
Assignment cn tl
 
Congestion control in tcp
Congestion control in tcpCongestion control in tcp
Congestion control in tcp
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 
Analyzing network packets Using Wireshark
Analyzing network packets Using WiresharkAnalyzing network packets Using Wireshark
Analyzing network packets Using Wireshark
 
3a data link layer continued
3a data link layer continued3a data link layer continued
3a data link layer continued
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
 
A Performance Comparison of TCP Protocols
A Performance Comparison of TCP Protocols A Performance Comparison of TCP Protocols
A Performance Comparison of TCP Protocols
 
Tcp Reliability Flow Control
Tcp Reliability Flow ControlTcp Reliability Flow Control
Tcp Reliability Flow Control
 
Importance of sliding window protocol
Importance of sliding window protocolImportance of sliding window protocol
Importance of sliding window protocol
 
Tcp congestion control
Tcp congestion controlTcp congestion control
Tcp congestion control
 
TCP Congestion Control
TCP Congestion ControlTCP Congestion Control
TCP Congestion Control
 
GO BACK N PROTOCOL
GO BACK N PROTOCOLGO BACK N PROTOCOL
GO BACK N PROTOCOL
 
Leaky bucket algorithm
Leaky bucket algorithmLeaky bucket algorithm
Leaky bucket algorithm
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 

En vedette

Company description plus
Company description plusCompany description plus
Company description plus
Aakash Sharma
 
1396257209tabelcomparativzilieri lg-140401052128-phpapp02
1396257209tabelcomparativzilieri lg-140401052128-phpapp021396257209tabelcomparativzilieri lg-140401052128-phpapp02
1396257209tabelcomparativzilieri lg-140401052128-phpapp02
Alexandru Pop
 
Vaal Mental Health - Business Profile v 6
Vaal Mental Health - Business Profile v 6Vaal Mental Health - Business Profile v 6
Vaal Mental Health - Business Profile v 6
Johan (Sipho) Coetzee
 
2.2 variables, evaluation and expressions w
2.2 variables, evaluation and expressions w2.2 variables, evaluation and expressions w
2.2 variables, evaluation and expressions w
Tzenma
 
โครงร่างโครงงาน
โครงร่างโครงงานโครงร่างโครงงาน
โครงร่างโครงงาน
Poohpiba Baw
 

En vedette (6)

Therazorsedge
TherazorsedgeTherazorsedge
Therazorsedge
 
Company description plus
Company description plusCompany description plus
Company description plus
 
1396257209tabelcomparativzilieri lg-140401052128-phpapp02
1396257209tabelcomparativzilieri lg-140401052128-phpapp021396257209tabelcomparativzilieri lg-140401052128-phpapp02
1396257209tabelcomparativzilieri lg-140401052128-phpapp02
 
Vaal Mental Health - Business Profile v 6
Vaal Mental Health - Business Profile v 6Vaal Mental Health - Business Profile v 6
Vaal Mental Health - Business Profile v 6
 
2.2 variables, evaluation and expressions w
2.2 variables, evaluation and expressions w2.2 variables, evaluation and expressions w
2.2 variables, evaluation and expressions w
 
โครงร่างโครงงาน
โครงร่างโครงงานโครงร่างโครงงาน
โครงร่างโครงงาน
 

Similaire à Week5 lec3-bscs1

5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
ZahouAmel1
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
SwatiHans10
 

Similaire à Week5 lec3-bscs1 (20)

Transport Layer
Transport LayerTransport Layer
Transport Layer
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
KandR_TCP (1).ppt notes for congestion control
KandR_TCP (1).ppt    notes for congestion controlKandR_TCP (1).ppt    notes for congestion control
KandR_TCP (1).ppt notes for congestion control
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
 
13_TCP_Attack.pptx
13_TCP_Attack.pptx13_TCP_Attack.pptx
13_TCP_Attack.pptx
 
Osi model
Osi modelOsi model
Osi model
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
Transport layer udp and tcp network
Transport layer udp and tcp networkTransport layer udp and tcp network
Transport layer udp and tcp network
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptx
 
Flow control
Flow controlFlow control
Flow control
 
Week4 lec1-bscs1
Week4 lec1-bscs1Week4 lec1-bscs1
Week4 lec1-bscs1
 
Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot Layer
 
04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
Ch3 transport layer Network
Ch3 transport layer NetworkCh3 transport layer Network
Ch3 transport layer Network
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
 
Flow Control (1).ppt
Flow Control (1).pptFlow Control (1).ppt
Flow Control (1).ppt
 
TCP.docx
TCP.docxTCP.docx
TCP.docx
 
Transmission control protocol
Transmission control protocolTransmission control protocol
Transmission control protocol
 
Transport layer
Transport layerTransport layer
Transport layer
 

Plus de syedhaiderraza (20)

Week16 lec1
Week16 lec1Week16 lec1
Week16 lec1
 
Week15 lec1
Week15 lec1Week15 lec1
Week15 lec1
 
Week14 lec2
Week14 lec2Week14 lec2
Week14 lec2
 
Week14 lec1
Week14 lec1Week14 lec1
Week14 lec1
 
Week13 lec2
Week13 lec2Week13 lec2
Week13 lec2
 
Week13 lec1
Week13 lec1Week13 lec1
Week13 lec1
 
Week11 lec2
Week11 lec2Week11 lec2
Week11 lec2
 
Week11 lec1
Week11 lec1Week11 lec1
Week11 lec1
 
Week10 lec1
Week10 lec1Week10 lec1
Week10 lec1
 
Week9 lec1
Week9 lec1Week9 lec1
Week9 lec1
 
Week5 lec1-bscs1
Week5 lec1-bscs1Week5 lec1-bscs1
Week5 lec1-bscs1
 
Week4 lec2-bscs1
Week4 lec2-bscs1Week4 lec2-bscs1
Week4 lec2-bscs1
 
Week3 lec3-bscs1
Week3 lec3-bscs1Week3 lec3-bscs1
Week3 lec3-bscs1
 
Week3 lec 2
Week3 lec 2Week3 lec 2
Week3 lec 2
 
Week3 lec 1
Week3 lec 1Week3 lec 1
Week3 lec 1
 
Week2 lec3-bscs1
Week2 lec3-bscs1Week2 lec3-bscs1
Week2 lec3-bscs1
 
Week2 lec2-bscs1
Week2 lec2-bscs1Week2 lec2-bscs1
Week2 lec2-bscs1
 
Week2 lec1-bscs1
Week2 lec1-bscs1Week2 lec1-bscs1
Week2 lec1-bscs1
 
Week1 lec2-bscs1
Week1 lec2-bscs1Week1 lec2-bscs1
Week1 lec2-bscs1
 
Week1 lec1-bscs1
Week1 lec1-bscs1Week1 lec1-bscs1
Week1 lec1-bscs1
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

Week5 lec3-bscs1

  • 1. Chapter 3 Transport Layer Computer Networking: A Top Down Approach, 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
  • 2. Pipelined Reliable Data Transfer Protocols  Pipelining has the following consequences for reliable data transfer  Range of sequence numbers must be increased  Sender and receiver sides may have to buffer more than one packet.  Two basic approaches towards pipeline error recovery: Go-Back-N, Selective Repeat
  • 3. Go-Back-N (GBN) Sender:  Sender is allowed to transmit multiple packets without waiting for an acknowledgement  Constrained to a certain maximum number N.  Base or send_base  Sequence number of oldest unacknowledged packet  Nextseqnum  Sequence number of next packet to be sent  The range of sequence numbers for transmitted but not acknowledged packets can be viewed as a window of size N.  This window slides forward as the protocol operates
  • 4. Go-Back-N GBN sender must respond to three types of events  Invocation from above (rdt_send() is called):  If window is full, returns data to upper layer  Maintain synchronization mechanism  Receipt of an ACK:  ACK for packet with seq # n is taken as“Cumulative ACK”  More shortly in receiver  Time out event:  Sender has timer for oldest unacknowledged packet • If timer expires, retransmit all unacknowledged packets
  • 5. Go-Back-N Receiver:  If a packet with seq # n is received correctly and is in order  ACK is sent and data is delivered to upper layers  For all other cases  Receiver discards the packet and resends ACK for most recently received in order packet  Packets are delivered one at a time to upper layers  If a packet k has been received and delivered, then all packets with seq # lower than k have also been delivered. r Receiver discards out of order packets  No receiver buffering  Need only remember expectedseqnum
  • 7. Selective Repeat  Selective Repeat protocol avoid unnecessary retransmissions o Sender only retransmits packets that were lost or are in error o A window size N is used to limit the no of outstanding unacknowledged packets in the pipeline
  • 8. Selective Repeat Sender:  Data received from upper layers o If window is full, returns data to upper layer o Maintain synchronization mechanism  Timeout o Each packet has its own timer o Single packet is retransmitted on timeout  ACK received: o Sender marked packet as received provided its in the window o Packets sequence no is equal to send_base, • The window base is moved forward to the unacknowledged packet
  • 9. Selective Repeat Receiver:  Packets with sequence no in the window  Selective ACK is sent to the sender whether or not it is in order.  Out-of-order: buffer but send ACK for that packet  Deliver base plus buffered packets  Packets with sequence number below the window base  An ACK must be generated even though the packet has already been acknowledged by the receiver
  • 10. Selective Repeat in Action http://www.eecis.udel.edu/~amer/450/TransportApplets/SR/SRindex.html
  • 11. Selective Repeat: Dilemma  Finite range of sequence numbers Example:  Seq #‟s: 0, 1, 2, 3  Window size=3  Receiver sees no difference in two scenarios!  Incorrectly passes duplicate data as new in (a)  Window size of one less than the sequence number space does not work  Window size must be less than or equal to half the size of sequence no. space
  • 12. TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581  Connection Oriented Handshake Send segments to each other to establish parameters of ensuing data transfer  Runs on the end systems  TCP connection is point to point (single sender and receiver) Does not support multicast (one sender many receivers)  TCP send buffer TCP grab a chunk of data from this buffer  MSS (Maximum Segment Size)  The maximum amount of data that can be grabbed and placed in a segment  TCP receive buffer
  • 13. TCP Segment Structure URG: urgent data ACK? PSH? RST, SYN, FIN: connection estab (setup, teardown commands) Same as in UDP To negotiate maximum segment size etc. source port # dest port # sequence number acknowledgement number head not len used UAP R S F Receive window Urg data pointer checksum Options (variable length) Used in implementing a reliable data transfer Used for flow control application data (variable length) Find more out about OPTONS? (SEE RFC 853, RFC 1323)
  • 14. TCP Sequence Numbers and ACKs Sequence Numbers:  Sequence nos. are over the stream of transmitted bytes and not over the series of transmitted segments  Sequence no. is the byte stream “number” of first byte in segment‟s data  Example:        Host A wants to send data to Host B File consisting of 500,000 bytes, MSS is 1,000 bytes First byte of stream is numbered zero TCP constructs 500 segments out of data stream First segment gets sequence number --- 0 Second segment gets sequence number----1000 Third segment gets sequence number------2000 and so on
  • 15. TCP Sequence Numbers  Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data is sent in five segments with the first four segments carrying 1,000 bytes and the last segment carrying 2,000 bytes?
  • 16. TCP Sequence Numbers Solution: The following shows the sequence number for each segment: Segment 1  10,010 (10,010 to 11,009) Segment 2  11,010 (11,010 to 12,009) Segment 3  12,010 (12,010 to 13,009) Segment 4  13,010 (13,010 to 14,009) Segment 5  14,010 (14,010 to 16,009)
  • 17. TCP ACKs Acknowledgement Numbers:  The acknowledgement no that hosts A puts in its segment is the sequence no of the next byte host A is expecting from host B.  Example  Host A receives all bytes numbered 0 through 535 from B  Host A puts 536 in the acknowledgment number field of the segment it sends to B  TCP acknowledges bytes up to first missing bytes in the stream  Cumulative Acknowledgement  How receiver handles out-of-order segments?  TCP RFCs do not impose any rules Two choices o The receiver discards out of order segments o Keeps out of order bytes and waits for missing bytes to fill
  • 18. TCP Sequence Numbers and ACKs Example:  Host A sends a character to Host B, which echoes it back to Host A.  Starting Sequence no for client and server are 42 and 79. Piggybacking:  Acknowledgement of client to server data is carried by segment of server to client data Host A Host B User types „C‟ host ACKs receipt of echoed „C‟ host ACKs receipt of „C‟, echoes back „C‟ Piggybacked time
  • 19. TCP Flow Control  Eliminate the possibility of sender overflowing receiver‟s buffer by transmitting too much, too fast.  Sender maintains a variable receive window – Gives the sender an idea of how much free space is available at receiver  Example  Host A is sending a large file to host B  Host B allocates a receive buffer and denotes size by RcvBuffer  LastByteRead The number of the last byte read from buffer by process in Host B  LastByteRcvd: The number of last byte that has been placed in buffer at B
  • 20. TCP Flow Control  RcvWindow is set to the amount of spare room in the buffer  RcvWindow= RcvBuffer - [LastByteRcvd - LastByteRead]  Host B informs Host A about how much spare room it has in the connection buffer.  Places RcvWindow in the receive window field of every segment  Host A keeps track of two variables  LastByteSent and LastByteAcked
  • 21. TCP Flow Control  LastByteSent – LastByteAcked – It is the amount of unacknowledged data that A has sent into the connection  LastByteSent – LastByteAcked RcvWindow – Keeping the unacknowledged data less than the value of RcvWindow  Suppose RcvWindow=0 – Host B advertises RcvWindow=0 to Host A – Suppose Host B has nothing to send to host A – TCP specification require Host A to send one byte of data Persistence Timer? Home Assignment