CS4470 Computer Networking Protocols

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

Assume that a file is transferred from a node A to a node B. The file has been fragmented in 5 frames. Frame 0 is corrupted, the ACK of frame 1 is corrupted,
Data link control. Data Link Control –Flow Control how much data may sent –Error Control How can error be detected and corrected.
Flow and Error Control. Flow Control Flow control coordinates the amount of data that can be sent before receiving acknowledgement It is one of the most.
Announcement Project 1 due last night, how is that ? Project 2 almost ready, out tomorrow, will post online –Much harder than project 1, start early!
Announcement Project 1 due last night, how is that ? Homework 1 grade, comments out –Will be discussed in the next lecture Homework 2 out Project 2 almost.
Transport Layer3-1 Reliable Data Transfer. Transport Layer3-2 Principles of Reliable data transfer r important in app., transport, link layers r top-10.
2: Application Layer 1 1DT066 Distributed Information System Chapter 3 Transport Layer.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
1 Reliable Data Transfer. 2 r Problem: Reliability  Want an abstraction of a reliable link even though packets can be corrupted or get lost r Solution:
CS 4396 Computer Networks Lab
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 11 Data Link Control Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Data Link Layer We have now discussed the prevalent shared channel technologies  Ethernet/IEEE  Wireless LANs (802.11) We have now covered chapters.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: Peer-to-Peer Protocols ARQ Protocols and Reliable Data Transfer Flow Control.
1 Transport Layer Lecture 10 Imran Ahmed University of Management & Technology.
CS470 Computer Networking Protocols
Transport Layer: Sliding Window Reliability
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Principles of reliable data transfer 0.
1 The utopia protocol  Unrealistic assumptions: –processing time ignored –infinite buffer space available –simplex: data transmitted in one direction.
DATA LINK CONTROL. DATA LINK LAYER RESPONSIBILTIES  FRAMING  ERROR CONTROL  FLOW CONTROL.
Computer Networking Lecture 16 – Reliable Transport.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
9. Principles of Reliable Data Transport – Part 1
Chapter 3 Transport Layer
Computer Communication & Networks
2.10 Flow and Error Control Before that ...
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
Reliable Transmission
Data Link Layer Flow Control.
Data Link Layer - 3 Dr. Sanjay P. Ahuja, Ph.D.
Part III Datalink Layer 10.
Chapter 11 Data Link Control
Sliding Window Protocol | Go-Back-N
Chapter 3 outline 3.1 transport-layer services
Last time Reliable Data Transfer
Data Communications and Networking Pipelined reliable data transfer
CMPT 371 Data Communications and Networking
Instructor Mazhar Hussain
Data Link Layer What does it do?
CIS 321 Data Communications & Networking
Flow Control.
ECE 4450:427/527 - Computer Networks Spring 2017
Data Link Layer: Data Link Control
Flow and Error Control.
Overview Jaringan Komputer (2)
rdt2.2: a NAK-free protocol
EEC-484/584 Computer Networks
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
CS4470 Computer Networking Protocols
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
rdt2.2: a NAK-free protocol
rdt2.2: a NAK-free protocol
rdt2.2: a NAK-free protocol
Advanced Computer Networks
rdt2.2: a NAK-free protocol
Chapter 3 outline 3.1 transport-layer services
Chapter 11 Data Link Control
CS4470 Computer Networking Protocols
The Transport Layer Reliability
TCP III - Error Control TCP Error Control.
CS4470 Computer Networking Protocols
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
Chapter 3 Transport Layer
CS 5565 Network Architecture and Protocols
Error detection: Outline
Error Checking continued
rdt2.2: a NAK-free protocol
Presentation transcript:

CS4470 Computer Networking Protocols 1/1/2019 CS4470 Computer Networking Protocols 15. TCP 2 Huiping Guo Department of Computer Science California State University, Los Angeles

Outline Principles of reliable transfer Stop and wait Go back N 1/1/2019 Outline Principles of reliable transfer Stop and wait Go back N 15. TCP 2 CS4470

Principles of reliable transfer Errors A segment is corrupted A segment is lost Automatic retransmission request (ARQ) When errors occur, the receiver sends a message to the sender asking for retransmission Types of ARQ Stop and wait Sliding window (Go back N) 15. TCP 2 CS4470

A trivial reliable transfer protocol Assumption A segment may be corrupted. NO segment gets lost Sender Sends a segment Waits for the acknowledgement for the segment If the acknowledgement is positive Sends the next segment If the acknowledgement is negative Resends the segment 15. TCP 2 CS4470

A trivial reliable transfer protocol Receiver Receives a segment Is the segment corrupted? Yes. Sends a negative acknowledgement (NAK) asking for retransmission No. Sends a positive acknowledgement (ACK). Waits for the next segment 15. TCP 2 CS4470

Problems with this protocol What happens if ACK/NAK is corrupted? sender doesn’t know what happened at receiver! A possible approach The sender just simply resends the segment . This causes possible duplicate segments The receiver cannot tell whether the received segment is the re-transmitted segment or a new segment A solution to this problem Add a field sequence number(1 bit) to the segment header The receiver only need to check the sequence number to determine whether or not the received segment is a retransmission. 15. TCP 2 CS4470

Stop-and-Wait Protocol v1 Characteristics Use 1 bit sequence number A NAK free protocol The receiver always sends positive acknowledgements ACK0: Seg1 is correctly received, waiting for seg 0 ACK1: Seg0 is correctly received, waiting for seg 1 15. TCP 2 CS4470

Stop-and-Wait Protocol v1(cont.) Sender: Sender keeps track of the sequence number k (0,1) of the current segment being sent out Sender sends out a segment k If the sender receives ACK k, go to step 1 If the sender receives ACK k+1 , k=k+1 mod 2, go to step 1 15. TCP 2 CS4470

Stop-and-Wait Protocol v1 (cont.) Receiver: keeps track of the sequence number of(0, 1) of the next expected segment Receiver is expecting segment k Receiver receives a segment . If the sequence number of the segment is not k, discards the segment , sends ack k, go to step 1 If sequence number is k and the segment is OK, sends ACK k=k+1 mod 2 to the sender, go to step 1 If segment k is corrupted, sends ACK k Go to step 1 15. TCP 2 CS4470

Stop-and-Wait v1 Examples Sender Receiver seg0 Sends seg0 Receives ack1 Sends seg1 seg1 ACK 0 ACK 1 Receives ack0 Receives seg0 Sends ack1 Receives seg1 Sends ack0 a. Without erros Sender Receiver seg0 Sends seg0 Receives seg0 Sends ack1 ACK 1 seg1 Receives ack1 Sends seg1 Receives seg1 Seg1 has errors Sends ack1 ACK 1 seg1 Receives ack1 resends seg1 b. With a seg corrupted 15. TCP 2 CS4470

Stop-and-Wait v1 Examples (cont.) Sender Receiver seg0 Sends seg0 Receives seg0 Sends ack1 ACK 1 seg1 Receives ack1 Sends seg1 Receives seg1 Sends ack0 ACK 0 Ack0 is corrupted resends seg1 seg1 Receives seg1, discards it Sends ack0 ACK 0 c. With an ack corrupted 15. TCP 2 CS4470

Stop-and-Wait Protocol v2 Stop-and-wait protocol v1 only works if there is no data loss. What if there is data loss? A segment may be lost An ACK may be lost Stop-and-wait protocol v2 Works with data errors AND data loss 15. TCP 2 CS4470

Stop-and-Wait Protocol v2 (cont.) Approach: sender waits “reasonable” amount of time for ACK retransmits if no ACK received in this time if segments(or ACKs) are just delayed (not lost): retransmission will be duplicate, but use of seq. #’s already handles this receiver must specify seq # of seg being ACKed requires countdown timer 15. TCP 2 CS4470

Stop-and-Wait examples Sender Receiver Sender Receiver seg0 Sends seg0 Receives ack1 Sends seg1 seg1 ACK 0 ACK 1 Receives ack0 Receives seg0 Sends ack1 Receives seg1 Sends ack0 a. Without errors seg0 Sends seg0 Receives seg0 Sends ack1 ACK 1 seg1 Receives ack1 Sends seg1 X loss seg1 timeout resends seg1 Receives seg1 Sends ack0 b. segment loss 15. TCP 2 CS4470

Stop-and-Wait examples Sender Receiver Sender Receiver seg0 Sends seg0 Receives seg0 Sends ack1 seg0 Sends seg0 ACK 1 Receives seg0 Sends ack1 ACK 1 seg1 Receives ack1 Sends seg1 Receives seg1 Sends ack0 seg1 Receives ack1 Sends seg1 Receives seg1 Sends ack0 ACK 0 ACK 0 lost Timeout Resends seg1 seg1 Receives seg1 Discards it Sends ack0 Receives ack0 Sends seg0 seg0 seg1 timeout Resends seg1 ACK 0 Receives ack0 Resends seg0 Receives seg0 Sends ack1 Receives seg1 Sends ack0 ACK 1 seg0 ACK 0 Receives ack1 Sends seg1 seg1 Receives seg0 Sends ack1 c. Ack loss d. Premature timeout 15. TCP 2 CS4470

Pros and Cons of Stop-and-wait Stop-and-wait is a complete reliable transfer protocol It’s very simple Cons Inefficient While the sender is waiting for an ACK, it doesn’t do anything. Why not the sender sends multiple segments at a time? Need more than 1 bits for the sequence number. 15. TCP 2 CS4470

RTT and transmission delay 1/1/2019 RTT and transmission delay Definition of RTT: time to send a small segment to travel from sender to receiver and back. Transmission delay R=link bandwidth (bps) L=segment length (bits) time to send bits into link = L/R Total delay RTT+L/R 15. TCP 2 CS4470

RTT and transmission delay first segment bit transmitted, t = 0 first segment bit arrives RTT ACK arrives, send next segment, t = RTT + L / R 15. TCP 2 CS4470

Performance of stop-and-wait sender receiver first segment bit transmitted, t = 0 last packet bit transmitted, t = L / R first segment bit arrives RTT last packet bit arrives, send ACK ACK arrives, send next segment, t = RTT + L / R 15. TCP 2 CS4470

Increased utilization first segment bit transmitted, t = 0 sender receiver RTT last bit transmitted, t = L / R first segment bit arrives last segment bit arrives, send ACK ACK arrives, send next segment, t = RTT + L / R last bit of 2nd segment arrives, send ACK last bit of 3rd frame arrives, send ACK Increase utilization by a factor of 3! 15. TCP 2 CS4470

Go-Back-N Based on a sliding window Use window to control number of segments to send Number of segments that the sender can send N-(nextseqnum – send_base) 15. TCP 2 CS4470

Go-Back-N Cumulative ACKs ACK (n): ACKs all segments up to, including seq # n - 1 Timer Only one timer is used. The timer is for the oldest transmitted, yet un-acked segment 15. TCP 2 CS4470

Go-back-N: sender Needs to send segments If the window is full, wait until it’s not full If the window is not full, sends out as many segment as allowed, adjusts nextsegnum Receive an ACK for un-acked segments Slide the window forward by the number of acked segments Start the timer Adjust send_base Timerout Re-transmit all un-acked segments in the window 15. TCP 2 CS4470

Go-back-N: receiver Waits for seg k Receives seg k, sends ack k+1 Receives, seg k+1, discards it and sends ack k Receives seg k-1, discards it and sends ack k 15. TCP 2 CS4470

Go-back-N example The window size is 4 ACK1 ACK2 ACK3 ACK4 15. TCP 2 CS4470

1/1/2019 Exercise Consider a sender sends  7 segments to  a receiver. The RTT between the sender and the receiver is 2ms.  The transmission time of each segment is 0.2ms. The timeout value is 3 ms.  In  each of the following cases, how long does it take for sender to transfer the 7 segments? (time between sending out the first segment   and receiving the ack of the last segment). a) Stop-and-wait protocol is used. b) Go-Back-N protocol is used.   The window size is 4. The 2nd  and the 5th segment are lost during the first transmission. For each case, draw a diagram that shows the interaction between the sender and receiver. You also need to provide the information about which segment is sent and the ACK number. 15. TCP 2 CS4470

For each segment, it takes 2+0. 2=2 For each segment, it takes 2+0.2=2.2 to send and receive the ack,  so the total time is 7x2.2 =15.4ms 15. TCP 2 CS4470

15. TCP 2 CS4470