210 likes | 332 Views
Communication Networks. Recitation 8 ARQ Protocols & Performance. Error Control. Automatic Repeat Request (ARQ) Error detection Acknowledgement (ACK) Retransmission after timeout Negative acknowledgement (NACK). t tran. DATA. t prop. ACK. DATA. RTT. NACK. Pipelining.
E N D
Communication Networks Recitation 8 ARQ Protocols & Performance Comnet 2010
Error Control Automatic Repeat Request (ARQ) • Error detection • Acknowledgement (ACK) • Retransmission after timeout • Negative acknowledgement (NACK) ttran DATA tprop ACK DATA RTT NACK Comnet 2010
Pipelining Acknowldegementarrives every msec Networkutilization 100% Packet arrives every msec Comnet 2010
Sliding Window Flow Control • Allow multiple frames to be in transit • Each frame is numbered • ACK includes number of frame • Transmitter can send up to W frames without ACK • Receiver may have a buffer W long • Sequence number bounded by k bits • frames are numbered modulo 2k Comnet 2010
Sender Perspective Window of frames that may be transmitted Frames already acknowledged …. …. 1 0 3 3 0 6 6 4 4 1 1 7 4 5 1 2 7 4 5 2 2 6 6 0 2 5 5 3 3 0 Frame sequence numbers Last frame acknowledged Window shrinks from trailing edge as frames are acknowledged Window expands from leading edge as ACKs received Window of frames that may be received Window expands from leading edge as ACKs are sent Window shrinks from trailing edge as frames are received Last frame acknowledged Sliding Window …. …. Receiver Perspective Frames already received Comnet 2010
F1 F0 F6 F5 F4 F3 F2 0 4 1 1 4 6 0 3 3 0 6 3 0 4 3 4 6 6 6 1 1 6 3 4 4 1 3 0 0 0 6 1 4 4 6 1 1 1 0 4 6 3 3 0 3 1 5 1 5 7 7 1 2 4 4 2 2 2 1 7 2 5 7 5 4 4 1 5 7 1 2 4 5 1 4 7 1 1 4 5 7 7 2 4 7 4 2 2 5 5 0 0 6 2 3 3 5 5 5 3 6 0 0 2 3 2 0 5 5 6 2 6 2 5 6 2 6 6 2 0 0 2 5 0 3 6 5 3 2 0 5 3 3 3 6 ACK 2 …. …. …. …. …. …. …. …. …. …. …. …. …. …. …. …. …. …. ACK 3 Sliding Window: Example Comnet 2010
Sliding Window Enhancements • Ack are cumulative • Receiver can acknowledge multiple frames • If duplex, use piggybacking • If both data and ACK, send them together • If no data to send, use ACK frame • If data but no acknowledgement to send, send last acknowledgement number again Comnet 2010
Go Back N • Sliding window protocol • Use window to control number of outstanding frames • If no error, cumulative ACK • as usual with frame sequence number • If corrupted frame: • Discard that frame and all future frames until that frame received correctly • Transmitter must go back and retransmit that frame and all subsequent frames Comnet 2010
Timeout Interval 0 5 3 3 8 1 4 9 4 6 2 7 10 5 5 6 7 8 2 3 4 ACK 0 ACK 1 ACK 2 ACK 3 ACK 4 ACK 5 ACK 6 ACK 7 0 1 E D D D D D D 2 6 7 8 Frames discarded by data link layer Error Go-Back-N: Example 1 Time Comnet 2010
3 3 4 4 5 5 Go-Back-N: Example 2 0 1 2 6 7 8 ACK 0 ACK 1 ACK 2 ACK 3 ACK 4 ACK 5 ACK 6 ACK 7 0 1 6 7 8 2 Frames delivered by data link layer Time Comnet 2010
Selective Repeat • Ack per frame • Only unAck frames are retransmitted • Out of order frames are accepted by the receiver and buffered • Minimizes retransmission • Receiver must maintain large enough buffer • More complex computation in sender Comnet 2010
Selective Repeat Example Transmitter (Primary) 0 1 2 3 4 5 2 6 0 ACK 1 ACK 0 ACK 3 ACK 4 ACK 5 ACK 2 Receiver (Secondary) 0 1 E 3 4 5 2 6 Frames 2-5 released Error Buffered by receiver Comnet 2010
Selective Repeat: Window Size Sequence Number space >= 2 Window Size 0 1 2 3 4 5 TIMEOUT 6 7 ACK 0 Comnet 2010
Performance: Notation • TRANS = Frame transmission time • PROP = Link propagation delay • RTT = 2 Prop • RTT+Trans = tiem from begin send to receive ACK • a = PROP/TRANS • Probability of Frame error in Sender-Receiver direction is P<<1 • Probability of Frame error in Receiver-Sender direction is 0 • W = Number of frames per window • Nr: average number of transmissions of an original frame Comnet 2010
Performance: No Errors • Frames transmitted = 2a + 1 if W > 2a + 1 = W otherwise • W >= 2a + 1 • Link is always utilized (U = 1) • W < 2a + 1 • U = W/(2a + 1) Comnet 2010
Performance: Unreliable LinkSelective Repeat • Number of retransmissions: Nr= i Pi-1(1-P)=1/(1-P) U = (1 – P) if (W > 1 +2a) W (1 – P) / (1 + 2a) if (W <= 1 +2a) Comnet 2010
Overview TCP = Transmission Control Protocol • Connection-oriented protocol • Provides a reliable unicast end-to-end byte stream over an unreliable internetwork. Comnet 2010
Connection-Oriented • Before any data transfer, TCP establishes a connection: • One TCP entity is waiting for a connection (“server”) • The other TCP entity (“client”) contacts the server • The actual procedure for setting up connections is more complex. • Each connection is full duplex Comnet 2010
TCP Connection Establishment • TCP uses a three-way handshake to open a connection: (1) ACTIVE OPEN: Client sends a segment with • SYN bit set * • port number of client • initial sequence number (ISN) of client (2) PASSIVE OPEN: Server responds with a segment with • SYN bit set * • initial sequence number of server • ACK for ISN of client (3) Client acknowledges by sending a segment with: • ACK ISN of server (* counts as one byte) Comnet 2010
Three-Way Handshake Comnet 2010
TCP States in “Normal” Connection Lifetime Comnet 2010