Errores ARQ

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Protocols and the TCP/IP Suite

ARQ

 Automatic Repeat reQQuest


 A flow and error control mechanism
which uses:
◦ Error detection
◦ Timers
◦ Acknowledgements
◦ Retransmissions

Automatic Repeat Request

 If error(s) is detected in received Frame, return NAK to


sender

 NAK can be explicit or implicit (Expiration of sender Timer)

 Sender starts a timer for each frame

 Timeout value = Expected delay for sender to receive


ACK for frame

Chapter 2 1
Protocols and the TCP/IP Suite

Automatic Repeat Request

 Sender keeps a copy of each un-ACKed frame to re-transmit


if required
◦ If ACK is received, discarding the copy
◦ If NAK is received (timer expired), re-transmit frame

 ACK can be a separate frame or a control field


Piggybacked in data frame going from receiver to
sender

Automatic Repeat Request

 Flow and error control techniques at link layer


◦ Stop
Stop--and
and--wait Protocol

◦ Go
Go--back
back--N Protocol

◦ Selective
Selective--reject Protocol (A.K.A. selective repeat)
repeat)

◦ Sliding window Protocol

Chapter 2 2
Protocols and the TCP/IP Suite

Stop-and
Stop-and--Wait
Protocol

Stop--and-
Stop and-Wait Protocol

 Each frame is assigned a Sequence Number

 Source transmits A Frame (e.g., frame SN= i) and waits


for ACK
ACKnowledgement
 Receiver acknowledges the receipt by sending back ACK
 ACK includes the Request Number (RN
RN) of next frame
(i+1)
 This implicitly says that frame i is Error
Error--Free
 If frame i is in error, receiver discards it and sends ACK

including RN=i

Chapter 2 3
Protocols and the TCP/IP Suite

Stop--and-
Stop and-Wait Protocol
 Source waits for ACK until timer expires
 Timeout =Tfram+2Tprop+Tack=2(
=2(TTtrans+Tprop)

Stop--and-
Stop and-Wait Protocol

 Retransmission, if timer expires & ACK not received


 Frames are sequenced as 0, 1, 2, …, m

 It is shown that for m>=1


>=1, transmissions have no conflict
 Minimum possible frame sequence m=1 (0,
0, 1, 0, 1, 0, 1, 0,)
0,
 Transmission Errors
◦ Lost data frame
◦ Damaged data frame at destination
◦ Lost ACK

Chapter 2 4
Protocols and the TCP/IP Suite

Stop--and
Stop and--Wait ARQ

Lost Frame
• Source sends Data Frame and waits for ACK
• Data Frame is lost
• No ACK is replied by receiver
•Timer expires
•Source Retransmits the frame

Stop--and
Stop and--Wait ARQ
Damaged Frame at destination
•Destination receives frame 1 in error
•NACK is sent back (No ACK & Timer expires)
• Sender knows Frame 1 is in error
•Source Retransmits frame 1

Chapter 2 5
Protocols and the TCP/IP Suite

Stop--and
Stop and--Wait ARQ

Lost ACK
•Frame1 is received at destination
•Destination sends ACK 0
•Source does not receive ACK 0
•Timer expires
•Source Retransmits Frame 1
•Destination Discards duplicated
Frmae1

Stop--and-
Stop and-Wait Link Utilization
 Source sends a single frame and waits for

Tfram+2Tprop+Tack=2(
=2(T
Ttrans+Tprop)
 Tprop is large relative to Ttrans
 Propagation delay is long relative to transmission time
 Transmission of only one frame at a time
 Waiting for a long time to receive ACK
 Link is mostly idle

 Stop-and-Wait Protocol Reduces Link Utilization

Chapter 2 6
Protocols and the TCP/IP Suite

Sliding Window
Protocol

Sliding Window Protocol


 Allows Multiple Frames to be Transmitted at the
same time
 Transmitter and receiver have sequence numbers
nt and nr
 Frames and ACKs must be numbered
 nt denotes the next frame to be transmitted
 i.e. the sequence number of the first frame not yet transmitted

 nr is the first packet not yet received (Expected)

Chapter 2 7
Protocols and the TCP/IP Suite

Sliding Window Protocol


 Transmitter and receiver have a window size wt and wr
 Window size = # of frames that can be transmitted
without an ACK
 Transmitter sends wt frames continuously and wait for
ACK
 ACK Includes sequence nr
 Receiver can ACK frames without permitting further
transmission (Receive Not Ready=RNR)
 Receiver must send a normal ACK to resume
 Sliding window becomes stop-and-wait if window size
is One

Sliding Window Protocol

Chapter 2 8
Protocols and the TCP/IP Suite

Sliding Window Protocol


Transmitter Operation

 Transmitter needs to buffer so that if data is lost,


it can be resent
 Transmitter may transmit up to wt frame ahead
of the latest acknowledgment na
 It may transmit frame number nt, where
nt < na+wt
 It keeps the sent packets in buffer until ACK
arrives

Sliding Window Protocol


Receiver Operation

 Receiver needs to buffer so that if data is


received out of order, it can be held until all
packets are received

 When a frame arrives


 Receiver checks to see if the frame number
falls in the receive window
 If so, receiver accepts it and updates nr
 If not, receiver discards it
 Receiver sends ACK including current nr

Chapter 2 9
Protocols and the TCP/IP Suite

Sliding Window Protocol


Sliding Window in a nutshell
 Sender can transmit several frames continuously
before needing an ACK
 If ACK received by sender before transmission is
finished, sender can continue transmitting
 An ACK can acknowledge the correct receipt of
multiple frames at the Receiver
 Frames may be ACKed by receiver at any time,
and may be transmitted by sender as long as the
window hasn’t filled up

Sliding Window Operation

Chapter 2 10
Protocols and the TCP/IP Suite

Sliding Window Example

RR = Receive Ready

window size = 7 segments

Go-Back
Go-Back--N
Protocol

Chapter 2 11
Protocols and the TCP/IP Suite

Go--Back-
Go Back-N Protocol
 Most common form of error control based on
Sliding Window

 Window size W = N

 Out of order (window) frames are discarded.

 If frame F is in error
◦ Receiver replies with rejection (REJ F / NACK
NACK)
◦ Receiver discards frame F and all subsequent
frames until it receives frame F correctly

Go--Back-
Go Back-N Protocol

 Upon receiving a NAK for frame F, transmitter


must Go Back and retransmit frame F and all
subsequent frames

 Sender resends frame F (and all subsequent


frames) when timer expires too

 If window W is selected large enough, sender can


transmit continuously if there are no transmission
errors

Chapter 2 12
Protocols and the TCP/IP Suite

Go--Back
Go Back--N Protocol
 NAK 3 means Retransmit Frame 3 (also tells sender that all
frames before frame 3 were received correctly)
 Receiver discards all subsequent frames
 Receiver only accepts Correct Frames received in Correct
Order
 So, receiver doesn’t need to Buffer any frames (to reorder them)

Go--Back
Go Back--N Protocol
 Frame 2 is lost
 Receiver is expecting Frame 2, But receives Frame 3
 Frame 3 (4,5,…) is discarded (even though correctly received)
 NAK is sent for Frame 2
 Frame 2 and All Subsequences are Retransmitted

Chapter 2 13
Protocols and the TCP/IP Suite

Go--Back-
Go Back-N Protocol

Piggybacking
• When traffic is Bi
Bi--Directional , ACK can be piggybacked
on packets going in other direction
• Each packet contains a
•SN field indicating the packet sequence number
•RN field ACKs the packet in the other direction
• If there is no packet before timeout, acknowledge RN is sent

Selective Repeat
Protocol

Chapter 2 14
Protocols and the TCP/IP Suite

Selective Repeat Protocol


 SR attempts to retransmit only those packets that are
actually lost

 Receiver does not discard the frames received after an


error-frame

 Receiver must be able to accept good frames out of


order

 Receiver stores the correct frames in a buffer and


waits for error-frame (Buffering)

Selective Repeat Protocol

 Receiver sends all frames to higher layer in order

 Window protocol just like Go-Back-N

 Window size W

Chapter 2 15
Protocols and the TCP/IP Suite

Selective Repeat Protocol


Need for Buffer
Sender must buffer all frames until they are ACK
ACKed
◦ Up to W un-ACKed frames

 Receiver must buffer frames until they can be


delivered in order

 Up to W frames may have to be buffered at


receiver
◦ If the first frame is received in error

Selective Repeat Protocol


When Frame 2 received correctly, receiver can sends Frames
2-5 to its Network layer and send ACK 6 back to Sender

Chapter 2 16
Protocols and the TCP/IP Suite

Selective Repeat Protocol


Retransmission Strategy
 Receiver ACK
ACKs the correct frames
 Not ACK
ACKed frames before timetime--out are assumed lost
or in error
 An explicit NAK (selective reject) can request
retransmission of just one frame
 NAK can expedite retransmission but is not strictly
needed
 Sender retransmits un-ACK
ACKed frame after a timeout
or upon a NAK

Chapter 2 17

You might also like