Transport Layer

6-1 Transport Layer Overview

–> Segments carry application data across the network

. Unreliable Reliable
Message Datagrams(UDP->connectionless)
Bytestream Stream(TCP->connection )

The socket APT supports both of these kinds of internet transport services. --> ports

  • Ports: a 16-bit identifiers which provide addressing for applications to use.
    –> servers often bind to “well-known ports” < 1024

6-2 UDP (User Datagram Protocol)

  • using:
  1. Voice-over-IP (real time , unreliable)
  2. DNS, RPC (message-oriented)
  3. DHCP (bootstrapping)

use socket:
client --request–> server
client <–reply-- server

  • Checksum: IP pseudoheader
    –> check key IP fields (addresses)
    –> value of zero means “No Checksum”

6-3 TCP -> Connection Establishment

Sender and receiver coordination or synchronizing themselves to prepare for the start of data transfer. --> set the parameters (like MSS(Maxmium Segment Size)…)

Three-Way Handshake

Client ---- SYN(SEQ=x;) ----> Server
(Established)Client <---- SYN(SEQ=y; ACK=x+1;) ---- Server
Client ---- (SEQ=x+1; ACK=y+1;) ----> Server (Established )

-> state meachine

  • ERROR: Suppose delayed, duplicate copies of the SYN and ACK arrive at the Server --> ACK will wrong (reject)

6-4 Connection Release

the main task is to close down both sides of the connection in an orderly way so that all of the pending data is delivered before both sides hang up.

  • Model

Active party ---- FIN(SEQ=x;) ----> Passive party
Active party <---- (SEQ=y; ACK=x+1;) ---- Passive party
…<–data<–data<–data–…
Active party <---- FIN(SEQ=y’; ACK=x+1;) ---- Passive party
Active party ---- (SEQ=x+1; ACK=y’+1;) ----> Passive party(CLOSED)
(timeout->CLOSED)

6-5 Sliding Window

either with frames, packets, or segments, as is convenient, since this algorithm could be used at either the link (AIQ), network, or transport layers.

Stop-and-Wait

ARQ with one message at a time is Stop-and-Wait (normal case below): SEQ =0 / 1

Sliding Window Protocol

  • Window size = W , means we can send W packets per RTT (=2D)

  • need W=2BD to fill network path

  • Sender: buffers up to W segments until they are acknowledged
    LFS=LAST FRAME SNET (Already sent out, but not yet acknowledged)
    LAR=LAST ACK RECEIVED
    ⇒ Size = LFS-LAR <= W

  • Receiver:
    LAS=LAST ACK SENT (looking for LAS+1)

Go-Back-N

  • Sender:

On timeout: Resends buffered packets starting at LAR+1;

  • Receiver:

Keeps only a single packet buffer for the next segment

Selective Repeat

  • Sender:

On timeout: Retransmit it individualy

  • Receiver:

Buffer W segments

-> on receive:

  1. buffer segments [LAS+1, LAS+W]
  2. press up to app in-order segments from LAS+1, and update LAS
  3. send ACK for LAS regardless(no matter new or old LAS)

Sequence Numbers:

  • Stop-and-Wait: Seq={0,1}

  • Selective Repeat:
    need W numbers for packets, plus W for acks of earlier packets --> 2W seq. numbers

  • GBN:
    W+1 (only one ack)

  • Typlically implement seq. number with an N-bit counter that wraps around at 2N-1

6-6 Flow Control

In addition to the sliding window to deal with the problem of making sure that the receiver can handle the data sender sending to it.

recevier – send WIN: the capacity of the buffer now --> sender
-> when Sender konws the receiver is full, it was blocked. (SEQ+LENTH < ACK+WIN)

6-7 Retransmission Timeout

the way we detect loss and hints decide to retransmit this using a timeout

  • strategy:
  1. Set timer when a segment is first sent.
  2. Cancel timer when ack is received --> if the timer goes off --> retransmit

Timeout Problem

if too large -> waste network capacity
if too short -> add load to the network
–> using RTT (in link)

  • Adaptive Timeout:

SRTTN+1 = 0.9SRTTN + 0.1RTTN+1 (smooth round-trip time)
SvarN+1 = 0.9SvarN + 0.1|RTTN+1 - SRTTN+1|
–to estimate the upper RTT in practice–> TCP TimeoutN = SRTTN + 4*SvarN

6-8 TCP (Transmission Control Protocol)

TCP provide your reliable bytestream service.

  • sliding window for reliability (with adaptive timeout)

  • flow control for slow receivers

  • congestion control to allocate network bandwidth

  • Ports (16-bits) --> identify the app (Socket API)

  • SEQ/ACK --> sliding window (selective repeat, with byte positions, rather than segment number)

  • “Three duplicate ACKs” treated as loss --> more robust

7-1 Congestion Overview

The buffer inside the routers will overflow --> congestion

  • Important task for network is to allocate its capacity to senders:

–> efficient:
capacity is used but there is no congestion.

–> fair:
every sender gets a resonable share the network.

  • In an effective solution: Transport and Network layers must work together!
  1. Network Layer: Congestion is inside the router --> Only Network layer can witnesses congestion --> Only it can provide direct feedback
  2. Transport Layer: Injecting the traffic into network on behalf of the applications. --> cause congestion --> Only it can reduce offered load

==》 Bandwidth allocation problem

7-2 Fairness of Allocations

  • efficient is more important than fairness.

Equal per flow ???

Max-Min Fairness ???

7-3 AIMD (Additive Increase Multiplicative Decrease) --> TCP

  • Open loop vs. Closed loop
    open: reserve bandwidth before use
    close: use feedback to adjust rates

TCP is a closed loop, host-driven, and window-based.
–> Transport layer adjusts sender’s behavior via window in response.

No conjestion: Additive Increase
when conjestion occur: Multiplicative Decrease

7-4 History of TCP Congestion Control

The congestion window (cwnd) is the same kind of adaptive sliding window which changes to prevent the sender from overriding the network.

7-5 TCP ACK Clocking

by using ACK Clocking we have nice, smooth traffic that’s well matched to the capacity of the network.

7-6 Slow Start (Additive Increase)

–> We want to quickly near the right rate, cwnd (SIZE)

–> Slow-Start: Start by doubling cwnd every RTT -> quickly reach large value (Ssthresh: Slow-start threshold) -> Additive Increase -> After a timeout -> sender slow-starts again with cwnd=1

  • Increment cwnd by 1 packet for each ACK

7-7 TCP Fast Retransmit & Fast Recovery

  • Inferring loss from ACKs: TCP treat three duplicate ACKs as a loss

Fast Retransmit: can repair a single segment loss and it can detect that there’s a segment has been lost very quickly. This is usually before the timeout goes.

Fast Recovery: when three-duplicate occur -> set ssthresh and cwnd = cwnd / 2 -> can help us send more data

Classical TCP (Slow-Start–ssthresh–>Additive Increase–Loss(Congestion)–>half ssthresh–>Additive Increase) --> TCP Reno (Repair one loss per RTT) --> NewReno (Repair multiple losses without timeout) --> SACK (like Selective Retransmit)

7-8 Explict Congestion Notification

Delay and router signals can let us avoid congestion

The router mark the congestion packet (ECN bits in IP header) --> receiver send a congestion signal to sender

发布了316 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_42347617/article/details/105653154