Transport Layerطبقة النقل

الشريحة 1 من 27

مقدمة الفصل

تفاصيل المصدرالفصل 3 · الشرائح ⁦2–3⁩
المصدر
الفصل 3 · الشرائح ⁦2–3⁩
ملاحظات حول المصدر (1)
  • كثير من شرائح النقل الموثوق رسوم لآلات الحالة؛ لُخّصت كلماتها هنا ولم تُنسخ الرسوم.

Transport services and protocolsخدمات النقل

Transport layer
Provides logical communication between app processes running on different hosts.
  • Transport protocols run in end systems.
  • Send side: breaks app messages into segments, passes to network layer.
  • Rcv side: reassembles segments into messages, passes to app layer.
  • More than one transport protocol available to apps — Internet: TCP and UDP.

Network layer

  • Logical communication between hosts
  • Analogy: postal service

Transport layer

  • Logical communication between processes
  • Relies on, enhances, network layer services
  • Analogy: Ann and Bill, who demux letters to in-house siblings

من الشرائح

  • Household analogy: hosts = houses; processes = kids; app messages = letters in envelopes.
تفاصيل المصدرالفصل 3 · الشرائح ⁦4–5⁩
المصدر
الفصل 3 · الشرائح ⁦4–5⁩

Internet transport-layer protocolsTCP وUDP باختصار

Transport services and protocols

TCP

  • Reliable, in-order delivery
  • Congestion control
  • Flow control
  • Connection setup

UDP

  • Unreliable, unordered delivery
  • No-frills extension of "best-effort" IP

Services not available

  • Delay guarantees
  • Bandwidth guarantees
تفاصيل المصدرالفصل 3 · الشريحة ⁦6⁩
المصدر
الفصل 3 · الشريحة ⁦6⁩

Multiplexing and demultiplexingتعدد الإرسال وفكّه

Multiplexing at senderتعدد الإرسال
Handle data from multiple sockets, add transport header (later used for demultiplexing).
Demultiplexing at receiverفكّ التعدد
Use header info to deliver received segments to correct socket.

How demultiplexing works

  • Host receives IP datagrams: each has source IP address and destination IP address.
  • Each datagram carries one transport-layer segment; each segment has source and destination port number.
  • Host uses IP addresses & port numbers to direct segment to appropriate socket.
تفاصيل المصدرالفصل 3 · الشرائح ⁦8–9⁩
المصدر
الفصل 3 · الشرائح ⁦8–9⁩

Connectionless vs connection-oriented demuxفكّ التعدد في UDP وTCP

Multiplexing and demultiplexing

Connectionless demux (UDP)

  • Receiver checks destination port # in segment and directs it to the socket with that port #
  • IP datagrams with same dest. port #, but different source IP addresses and/or source port numbers, go to the same socket at dest

Connection-oriented demux (TCP)

  • TCP socket identified by 4-tuple: source IP, source port, dest IP, dest port
  • Receiver uses all four values to direct segment to appropriate socket
  • Web servers have different sockets for each connecting client; non-persistent HTTP will have a different socket for each request

من الشرائح

  • Slide 13: three segments, all destined to IP address B, dest port 80 — from (A, 9157), (C, 5775) and (C, 9157) — are demultiplexed to different sockets.

Two different clients send segments to port 5000 on server S. Under which protocol are both segments necessarily delivered to the same socket on S?

تفاصيل المصدرالفصل 3 · الشرائح ⁦10, 12, 13⁩
المصدر
الفصل 3 · الشرائح ⁦10, 12, 13⁩

UDP: User Datagram Protocolبروتوكول UDP

UDP [RFC 768]
"No frills," "bare bones" Internet transport protocol; "best effort" service: UDP segments may be lost or delivered out-of-order to app. Connectionless: no handshaking between UDP sender, receiver; each UDP segment handled independently of others.

UDP use

  • Streaming multimedia apps (loss tolerant, rate sensitive)
  • DNS
  • SNMP
  • Reliable transfer over UDP: add reliability at application layer — application-specific error recovery!

UDP segment header

  • Source port #, dest port #
  • Length, in bytes of UDP segment, including header
  • Checksum
  • Application data (payload)

Why is there a UDP?

  • No connection establishment (which can add delay)
  • Simple: no connection state at sender, receiver
  • Small header size
  • No congestion control: UDP can blast away as fast as desired
تفاصيل المصدرالفصل 3 · الشرائح ⁦16–17⁩
المصدر
الفصل 3 · الشرائح ⁦16–17⁩

UDP checksumالمجموع الاختباري

UDP: User Datagram Protocol

Goal
Detect "errors" (e.g., flipped bits) in transmitted segment.

Sender

  • Treat segment contents, including header fields, as sequence of 16-bit integers
  • Checksum: addition (one's complement sum) of segment contents
  • Put checksum value into UDP checksum field

Receiver

  • Compute checksum of received segment
  • Check if computed checksum equals checksum field value
  • NO — error detected
  • YES — no error detected. But maybe errors nonetheless?

A receiver recomputes the UDP checksum and it equals the checksum field. What can it conclude?

تفاصيل المصدرالفصل 3 · الشرائح ⁦18–19⁩
المصدر
الفصل 3 · الشرائح ⁦18–19⁩

Reliable data transfer: getting startedبداية النقل الموثوق

Principles of reliable data transfer: rdt1.0 to rdt2.2

Principles of reliable data transfer (slides 22–23)

  • Important in application, transport and link layers — on the "top-10 list of important networking topics"!
  • (a) Provided service: the sending process passes data down a reliable channel to the receiver process.
  • (b) Service implementation: rdt_send() → reliable data transfer protocol (sending side) → udt_send() → unreliable channel → rdt_rcv() → reliable data transfer protocol (receiving side) → deliver_data().
  • Characteristics of the unreliable channel will determine the complexity of the reliable data transfer protocol (rdt).

Reliable data transfer is important in application, transport and link layers. Characteristics of the unreliable channel will determine the complexity of the reliable data transfer protocol (rdt).

rdt_send()
Called from above (e.g., by app). Passed data to deliver to receiver upper layer.
udt_send()
Called by rdt, to transfer packet over unreliable channel to receiver.
rdt_rcv()
Called when packet arrives on rcv-side of channel.
deliver_data()
Called by rdt to deliver data to upper layer.
  • Incrementally develop sender, receiver sides of rdt.
  • Consider only unidirectional data transfer — but control info will flow on both directions!
  • Use finite state machines (FSM) to specify sender, receiver.
  • rdt1.0: underlying channel perfectly reliable (no bit errors, no loss of packets); separate FSMs for sender and receiver.
تفاصيل المصدرالفصل 3 · الشرائح ⁦21, 24, 25, 26⁩
المصدر
الفصل 3 · الشرائح ⁦21, 24, 25, 26⁩

rdt2.0: channel with bit errorsrdt2.0

Principles of reliable data transfer: rdt1.0 to rdt2.2

  • Underlying channel may flip bits in packet; checksum to detect bit errors.
ACKs
Receiver explicitly tells sender that pkt received OK.
NAKs
Receiver explicitly tells sender that pkt had errors. Sender retransmits pkt on receipt of NAK.

rdt2.0 has a fatal flaw!

  • What happens if ACK/NAK corrupted? Sender doesn't know what happened at receiver; can't just retransmit: possible duplicate.
  • Handling duplicates: sender retransmits current pkt if ACK/NAK corrupted; sender adds sequence number to each pkt; receiver discards (doesn't deliver up) duplicate pkt.
  • Stop and wait: sender sends one packet, then waits for receiver response.
تفاصيل المصدرالفصل 3 · الشرائح ⁦27, 28, 32⁩
المصدر
الفصل 3 · الشرائح ⁦27, 28, 32⁩

rdt2.0 and rdt2.2: the state machinesآلات الحالة rdt2.0 وrdt2.2

Principles of reliable data transfer: rdt1.0 to rdt2.2

rdt2.0: FSM specification — sender (slide 29); Λ = no action
From stateEvent (above the line)Actions (below the line)To state
Wait for call from aboverdt_send(data)
  • sndpkt = make_pkt(data, checksum)
  • udt_send(sndpkt)
Wait for ACK or NAK
Wait for ACK or NAKrdt_rcv(rcvpkt) && isNAK(rcvpkt)udt_send(sndpkt)Wait for ACK or NAK
Wait for ACK or NAKrdt_rcv(rcvpkt) && isACK(rcvpkt)ΛWait for call from above
rdt2.0 — receiver (slide 29)
From stateEvent (above the line)Actions (below the line)To state
Wait for call from belowrdt_rcv(rcvpkt) && corrupt(rcvpkt)udt_send(NAK)Wait for call from below
Wait for call from belowrdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
  • extract(rcvpkt, data)
  • deliver_data(data)
  • udt_send(ACK)
Wait for call from below
  • Operation with no errors (slide 30): rdt_send → packet sent → receiver finds it not corrupt, delivers and sends ACK → sender gets the ACK and waits for the next call from above.
  • Error scenario (slide 31): the receiver finds the packet corrupt and sends NAK → the sender retransmits (udt_send(sndpkt)) → the retransmission arrives uncorrupted, is delivered and ACKed.
rdt2.2: sender FSM fragment (slide 37) — no NAK; the ACK carries a sequence number
From stateEvent (above the line)Actions (below the line)To state
Wait for call 0 from aboverdt_send(data)
  • sndpkt = make_pkt(0, data, checksum)
  • udt_send(sndpkt)
Wait for ACK 0
Wait for ACK 0rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isACK(rcvpkt,1) )udt_send(sndpkt)Wait for ACK 0
Wait for ACK 0rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt,0)Λ
  • (next state
  • not drawn in the fragment)
rdt2.2: receiver FSM fragment (slide 37)
From stateEvent (above the line)Actions (below the line)To state
Wait for 0 from belowrdt_rcv(rcvpkt) && (corrupt(rcvpkt) || has_seq1(rcvpkt))udt_send(sndpkt)Wait for 0 from below
(previous state; not drawn in the fragment)rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt)
  • extract(rcvpkt, data)
  • deliver_data(data)
  • sndpkt = make_pkt(ACK1, chksum)
  • udt_send(sndpkt)
Wait for 0 from below
تفاصيل المصدرالفصل 3 · الشرائح ⁦29, 30, 31, 37⁩
المصدر
الفصل 3 · الشرائح ⁦29, 30, 31, 37⁩

rdt2.1 and rdt2.2rdt2.1 وrdt2.2

Principles of reliable data transfer: rdt1.0 to rdt2.2

rdt2.1: discussion (slide 35)

Sender

  • Seq # added to pkt
  • Two seq. #'s (0,1) will suffice
  • Must check if received ACK/NAK corrupted
  • Twice as many states: must "remember" whether "expected" pkt should have seq # of 0 or 1

Receiver

  • Must check if received packet is duplicate (state indicates whether 0 or 1 is expected pkt seq #)
  • Note: receiver can not know if its last ACK/NAK received OK at sender
rdt2.2: a NAK-free protocol
Same functionality as rdt2.1, using ACKs only: instead of NAK, receiver sends ACK for last pkt received OK, explicitly including the seq # of the pkt being ACKed. Duplicate ACK at sender results in same action as NAK: retransmit current pkt.

In rdt2.2, the sender has sent packet 1 and receives an ACK carrying sequence number 0. What does it do?

تفاصيل المصدرالفصل 3 · الشرائح ⁦35–36⁩
المصدر
الفصل 3 · الشرائح ⁦35–36⁩

rdt3.0: channels with errors and lossrdt3.0

rdt3.0 and its performance

New assumption: the underlying channel can also lose packets (data, ACKs). Checksum, seq. #, ACKs and retransmissions will be of help… but not enough.

Approach

  1. 1

    Sender waits a "reasonable" amount of time for ACK.

  2. 2

    Retransmits if no ACK received in this time.

  3. 3

    If pkt (or ACK) was just delayed (not lost): retransmission will be duplicate, but seq. #'s already handles this; receiver must specify seq # of pkt being ACKed.

  4. 4

    Requires countdown timer.

rdt3.0 in action (slides 40–41)

  • (a) no loss
  • (b) packet loss
  • (c) ACK loss
  • (d) premature timeout / delayed ACK
rdt3.0 sender (slide 39); Λ = no action
From stateEvent (above the line)Actions (below the line)To state
Wait for call 0 from aboverdt_send(data)
  • sndpkt = make_pkt(0, data, checksum)
  • udt_send(sndpkt)
  • start_timer
Wait for ACK0
Wait for call 0 from aboverdt_rcv(rcvpkt)ΛWait for call 0 from above
Wait for ACK0rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isACK(rcvpkt,1) )ΛWait for ACK0
Wait for ACK0timeout
  • udt_send(sndpkt)
  • start_timer
Wait for ACK0
Wait for ACK0rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt,0)stop_timerWait for call 1 from above
Wait for call 1 from aboverdt_rcv(rcvpkt)ΛWait for call 1 from above
Wait for call 1 from aboverdt_send(data)
  • sndpkt = make_pkt(1, data, checksum)
  • udt_send(sndpkt)
  • start_timer
Wait for ACK1
Wait for ACK1rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isACK(rcvpkt,0) )ΛWait for ACK1
Wait for ACK1timeout
  • udt_send(sndpkt)
  • start_timer
Wait for ACK1
Wait for ACK1rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt,1)stop_timerWait for call 0 from above
تفاصيل المصدرالفصل 3 · الشرائح ⁦38–41⁩
المصدر
الفصل 3 · الشرائح ⁦38–41⁩

Performance of rdt3.0 (stop-and-wait)أداء أرسل وانتظر

rdt3.0 and its performance

U_sender
Utilization — fraction of time sender busy sending.

المسألة

1 Gbps link, 15 ms prop. delay (RTT = 30 msec), 8000 bit packet

المعطيات

L
8000 bits
R
10⁹ bits/sec
RTT
30 msec

الصيغة

U_sender = (L/R) / (RTT + L/R)

A stop-and-wait sender uses a 100 Mbps link to send 10,000-bit packets; the RTT is 20 ms. Approximately what is U_sender?

تفاصيل المصدرالفصل 3 · الشرائح ⁦42–43⁩
المصدر
الفصل 3 · الشرائح ⁦42–43⁩

Pipelined protocolsالإرسال الأنبوبي

Pipelining
Sender allows multiple, "in-flight", yet-to-be-acknowledged pkts. Range of sequence numbers must be increased; buffering at sender and/or receiver.

المسألة

3-packet pipelining (slide 45)

الصيغة

U_sender = (3L/R) / (RTT + L/R)

خطوات الحل

  1. = .0024 / 30.008

النتيجة

= 0.00081 — 3-packet pipelining increases utilization by a factor of 3!

Two generic forms of pipelined protocols (slide 46)
Go-Back-NSelective Repeat
Unacked packets in pipelineUp to NUp to N
ACKs
  • Receiver only sends cumulative ack
  • doesn't ack packet if there's a gap
Rcvr sends individual ack for each packet
TimersSender has timer for oldest unacked packetSender maintains timer for each unacked packet
On timeoutRetransmit all unacked packetsRetransmit only that unacked packet
Out-of-order packets at receiverDiscarded (no receiver buffering)Buffered for eventual in-order delivery
تفاصيل المصدرالفصل 3 · الشرائح ⁦44–46⁩
المصدر
الفصل 3 · الشرائح ⁦44–46⁩

Go-Back-NGo-Back-N

GBN sender

  • k-bit seq # in pkt header; "window" of up to N consecutive unack'ed pkts allowed
  • ACK(n): ACKs all pkts up to, including seq # n — "cumulative ACK"; may receive duplicate ACKs
  • Timer for oldest in-flight pkt
  • timeout(n): retransmit packet n and all higher seq # pkts in window

GBN receiver

  • ACK-only: always send ACK for correctly-received pkt with highest in-order seq # (may generate duplicate ACKs; need only remember expectedseqnum)
  • Out-of-order pkt: discard (don't buffer): no receiver buffering! Re-ACK pkt with highest in-order seq #

GBN in action (N = 4; pkt2 lost)

  1. 1

    Sender sends pkt0–pkt3; receiver gets pkt0, pkt1 and sends ack0, ack1. pkt2 is lost.

  2. 2

    Receiver gets pkt3: discards it, (re)sends ack1.

  3. 3

    Sender (on ack0, ack1) sends pkt4, pkt5; receiver discards each and (re)sends ack1; sender ignores duplicate ACKs.

  4. 4

    pkt 2 timeout: sender sends pkt2, pkt3, pkt4, pkt5 again.

  5. 5

    Receiver delivers pkt2, pkt3, pkt4, pkt5 and sends ack2–ack5.

تفاصيل المصدرالفصل 3 · الشرائح ⁦47, 49, 50⁩
المصدر
الفصل 3 · الشرائح ⁦47, 49, 50⁩

Selective RepeatSelective Repeat

  • Receiver individually acknowledges all correctly received pkts; buffers pkts, as needed, for eventual in-order delivery to upper layer.
  • Sender only resends pkts for which ACK not received; sender timer for each unACKed pkt.
  • Sender window: N consecutive seq #'s; limits seq #s of sent, unACKed pkts.
Selective repeat: sender, receiver windows (slide 52) — window size N
ViewPointerSequence-number states
(a) Sendersend_base (start of window), nextseqnum
  • already ack'ed
  • sent, not yet ack'ed
  • usable, not yet sent
  • not usable
(b) Receiverrcv_base (start of window)
  • out of order (buffered) but already ack'ed
  • expected, not yet received
  • acceptable (within window)
  • not usable

Selective Repeat sender

  • Data from above: if next available seq # in window, send pkt
  • timeout(n): resend pkt n, restart timer
  • ACK(n) in [sendbase, sendbase+N]: mark pkt n as received; if n smallest unACKed pkt, advance window base to next unACKed seq #

Selective Repeat receiver

  • pkt n in [rcvbase, rcvbase+N−1]: send ACK(n); out-of-order: buffer; in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt
  • pkt n in [rcvbase−N, rcvbase−1]: ACK(n)
  • Otherwise: ignore

من الشرائح

  • Selective Repeat in action (N = 4, pkt2 lost): receiver buffers pkt3, pkt4, pkt5 and sends ack3, ack4, ack5; at pkt 2 timeout only pkt2 is resent; then pkt2–pkt5 are delivered and ack2 is sent.

With window N = 4, packets 0–5 are sent and packet 3 is lost; everything else arrives. When packet 3's timer expires, which packets are retransmitted under Go-Back-N and under Selective Repeat?

تفاصيل المصدرالفصل 3 · الشرائح ⁦51, 53, 54⁩
المصدر
الفصل 3 · الشرائح ⁦51, 53, 54⁩

TCP overview and segment structureنظرة على TCP

TCP overview, segment structure, sequence numbers

  1. Point-to-point
  2. Reliable, in-order byte stream
  3. Pipelined
  4. Full duplex data
  5. Connection-oriented
  6. Flow controlled
FieldMeaning on slide 57
Source port #, dest port #Ports, as in every segment
Sequence number, acknowledgement numberCounting by bytes of data (not segments!)
ACK flagACK # valid
RST, SYN, FIN flagsConnection estab (setup, teardown commands)
URG, PSH flagsUrgent data / push data now (generally not used)
Receive window# bytes rcvr willing to accept
ChecksumInternet checksum (as in UDP)
تفاصيل المصدرالفصل 3 · الشرائح ⁦56–57⁩
المصدر
الفصل 3 · الشرائح ⁦56–57⁩

TCP sequence numbers and ACKsأرقام التسلسل والإقرار

TCP overview, segment structure, sequence numbers

Sequence numberرقم التسلسل
Byte stream "number" of first byte in segment's data.
Acknowledgementرقم الإقرار
Seq # of next byte expected from other side; cumulative ACK.

المسألة

Simple telnet scenario (slide 59): the user types 'C'

خطوات الحل

  1. Host A → B: Seq=42, ACK=79, data = 'C'
  2. Host B → A (ACKs receipt of 'C', echoes back 'C'): Seq=79, ACK=43, data = 'C'
  3. Host A → B (ACKs receipt of echoed 'C'): Seq=43, ACK=80

النتيجة

Each ACK number is the next byte expected: 42 + 1 = 43 and 79 + 1 = 80.

Setting the timeout (slide 60)

  • Longer than RTT — but RTT varies.
  • Too short: premature timeout, unnecessary retransmissions. Too long: slow reaction to segment loss.
  • SampleRTT: measured time from segment transmission until ACK receipt; ignore retransmissions. Want estimated RTT "smoother": average several recent measurements, not just current SampleRTT.

Host A sends Host B a segment with Seq = 200 carrying 50 bytes of data, and B has received all earlier bytes. What acknowledgement number does B put in its reply?

تفاصيل المصدرالفصل 3 · الشرائح ⁦58–60⁩
المصدر
الفصل 3 · الشرائح ⁦58–60⁩

TCP reliable data transfer: sender eventsأحداث مرسل TCP

TCP creates rdt service on top of IP's unreliable service: pipelined segments, cumulative acks, single retransmission timer. Retransmissions are triggered by timeout events and duplicate acks.

Data rcvd from app
Create segment with seq # (byte-stream number of first data byte in segment); start timer if not already running (timer for oldest unacked segment; expiration interval: TimeOutInterval).
Timeout
Retransmit segment that caused timeout; restart timer.
Ack rcvd
If ack acknowledges previously unacked segments: update what is known to be ACKed; start timer if there are still unacked segments.

Retransmission scenarios (slides 64–65)

  • lost ACK scenario
  • premature timeout
  • cumulative ACK
تفاصيل المصدرالفصل 3 · الشرائح ⁦62–65⁩
المصدر
الفصل 3 · الشرائح ⁦62–65⁩

TCP ACK generationتوليد الإقرار في TCP

TCP reliable data transfer

TCP ACK generation [RFC 1122, RFC 2581] (slide 66)
Event at receiverTCP receiver action
Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKedDelayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK
Arrival of in-order segment with expected seq #. One other segment has ACK pendingImmediately send single cumulative ACK, ACKing both in-order segments
Arrival of out-of-order segment higher-than-expect seq. #. Gap detectedImmediately send duplicate ACK, indicating seq. # of next expected byte
Arrival of segment that partially or completely fills gapImmediate send ACK, provided that segment starts at lower end of gap

A TCP receiver expects byte 500 but a segment starting at byte 700 arrives (a gap is detected). What does it do?

تفاصيل المصدرالفصل 3 · الشريحة ⁦66⁩
المصدر
الفصل 3 · الشريحة ⁦66⁩

TCP fast retransmitإعادة الإرسال السريع

TCP reliable data transfer

  • Time-out period often relatively long: long delay before resending lost packet.
  • Detect lost segments via duplicate ACKs: sender often sends many segments back-to-back; if a segment is lost, there will likely be many duplicate ACKs.
TCP fast retransmit
If sender receives 3 ACKs for same data ("triple duplicate ACKs"), resend unacked segment with smallest seq # — likely that unacked segment lost, so don't wait for timeout.

من الشرائح

  • Slide 68: Seq=92 (8 bytes) and Seq=100 (20 bytes) are sent; Seq=100 is lost; Host B keeps answering ACK=100; on receipt of the triple duplicate ACK, Host A resends Seq=100, 20 bytes of data — before the timeout.
تفاصيل المصدرالفصل 3 · الشرائح ⁦67–68⁩
المصدر
الفصل 3 · الشرائح ⁦67–68⁩

TCP flow controlالتحكم في التدفق

Flow control
Receiver controls sender, so sender won't overflow receiver's buffer by transmitting too much, too fast.
  1. 1

    Application may remove data from TCP socket buffers slower than the TCP receiver is delivering.

  2. 2

    Receiver "advertises" free buffer space by including the rwnd value in the TCP header of receiver-to-sender segments.

  3. 3

    Sender limits amount of unacked ("in-flight") data to receiver's rwnd value.

  4. 4

    Guarantees receive buffer will not overflow.

  • RcvBuffer size set via socket options (typical default is 4096 bytes); many operating systems autoadjust RcvBuffer.
تفاصيل المصدرالفصل 3 · الشرائح ⁦70–71⁩
المصدر
الفصل 3 · الشرائح ⁦70–71⁩

Connection management: the 3-way handshakeالمصافحة الثلاثية

TCP connection management

Before exchanging data, sender/receiver "handshake"

  • Agree to establish connection (each knowing the other willing to establish connection).
  • Agree on connection parameters (seq # client-to-server and server-to-client; rcvBuffer size at server, client).

Will a 2-way handshake always work?

  • Variable delays; retransmitted messages (e.g., req_conn(x)) due to message loss; message reordering; can't "see" other side.
  • Failure scenarios: half open connection! (no client!); duplicate data accepted.

TCP 3-way handshake (slide 76)

  1. Client

    Choose init seq num x; send TCP SYN msg: SYNbit=1, Seq=x → SYNSENT.

  2. Server

    Choose init seq num y; send TCP SYNACK msg, acking SYN: SYNbit=1, Seq=y; ACKbit=1; ACKnum=x+1 → SYN RCVD.

  3. Client

    Received SYNACK(x) indicates server is live; send ACK for SYNACK: ACKbit=1, ACKnum=y+1 — this segment may contain client-to-server data → ESTAB.

  4. Server

    Received ACK(y) indicates client is live → ESTAB.

A client starts a TCP connection with initial sequence number x = 500; the server chooses y = 9000. What are the ACK numbers in the server's SYNACK and in the client's final ACK?

تفاصيل المصدرالفصل 3 · الشرائح ⁦73–76⁩
المصدر
الفصل 3 · الشرائح ⁦73–76⁩

Principles of congestion controlمبادئ الازدحام

Congestion
Informally: "too many sources sending too much data too fast for network to handle" — different from flow control!

Manifestations

  • Lost packets (buffer overflow at routers)
  • Long delays (queueing in router buffers)

End-end congestion control

  • No explicit feedback from network
  • Congestion inferred from end-system observed loss, delay
  • Approach taken by TCP

Network-assisted congestion control

  • Routers provide feedback to end systems
  • Single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM)
  • Explicit rate for sender to send at
تفاصيل المصدرالفصل 3 · الشرائح ⁦78–79⁩
المصدر
الفصل 3 · الشرائح ⁦78–79⁩

TCP congestion control: AIMD and slow startAIMD والبداية البطيئة

cwnd
TCP sender congestion window size. Sender increases transmission rate (window size), probing for usable bandwidth, until loss occurs.
Additive increase
Increase cwnd by 1 MSS every RTT until loss detected.
Multiplicative decrease
Cut cwnd in half after loss.
  • AIMD saw tooth behavior: probing for bandwidth.
TCP Slow Start
When connection begins, increase rate exponentially until first loss event: initially cwnd = 1 MSS; double cwnd every RTT (done by incrementing cwnd for every ACK received). Initial rate is slow but ramps up exponentially fast.

Right after its connection is set up, a TCP sender may send one segment in the first RTT. If nothing is lost, how many segments may it send during the fourth RTT?

تفاصيل المصدرالفصل 3 · الشرائح ⁦81–82⁩
المصدر
الفصل 3 · الشرائح ⁦81–82⁩

Reacting to loss; fairnessالاستجابة للفقد والعدالة

TCP congestion control

TCP: detecting, reacting to loss (slide 83)
Loss signalTCP RenoTCP Tahoe
Timeout
  • cwnd set to 1 MSS
  • grows exponentially to threshold, then linearly
cwnd set to 1
3 duplicate ACKs
  • cwnd cut in half
  • then grows linearly
cwnd set to 1
  • 3 dup ACKs indicate network capable of delivering some segments — so Reno only halves cwnd.
TCP fairness
Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K.

A campus gateway link of 60 Mbps is the bottleneck for 3 long-lived TCP downloads. What average rate should each download get, if TCP meets its fairness goal?

تفاصيل المصدرالفصل 3 · الشرائح ⁦83–84⁩
المصدر
الفصل 3 · الشرائح ⁦83–84⁩

الخلاصة

تفاصيل المصدرالفصل 3 · الشريحة ⁦85⁩
المصدر
الفصل 3 · الشريحة ⁦85⁩

خريطة الفصل

    1. 1مقدمة الفصل
  1. Transport services and protocolsخدمات النقل وبروتوكولاته

    1. 2Transport services and protocolsخدمات النقل
    2. 3Internet transport-layer protocolsTCP وUDP باختصار
  2. Multiplexing and demultiplexingتعدد الإرسال وفكّه

    1. 4Multiplexing and demultiplexingتعدد الإرسال وفكّه
    2. 5Connectionless vs connection-oriented demuxفكّ التعدد في UDP وTCP
  3. UDP: User Datagram Protocolبروتوكول UDP

    1. 6UDP: User Datagram Protocolبروتوكول UDP
    2. 7UDP checksumالمجموع الاختباري
  4. Principles of reliable data transfer: rdt1.0 to rdt2.2مبادئ النقل الموثوق: من rdt1.0 إلى rdt2.2

    1. 8Reliable data transfer: getting startedبداية النقل الموثوق
    2. 9rdt2.0: channel with bit errorsrdt2.0
    3. 10rdt2.0 and rdt2.2: the state machinesآلات الحالة rdt2.0 وrdt2.2
    4. 11rdt2.1 and rdt2.2rdt2.1 وrdt2.2
  5. rdt3.0 and its performancerdt3.0 وأداؤه

    1. 12rdt3.0: channels with errors and lossrdt3.0
    2. 13Performance of rdt3.0 (stop-and-wait)أداء أرسل وانتظر
  6. Pipelined protocols: Go-Back-N and Selective Repeatالبروتوكولات الأنبوبية: GBN وSelective Repeat

    1. 14Pipelined protocolsالإرسال الأنبوبي
    2. 15Go-Back-NGo-Back-N
    3. 16Selective RepeatSelective Repeat
  7. TCP overview, segment structure, sequence numbersنظرة على TCP ومقطعه وأرقام التسلسل

    1. 17TCP overview and segment structureنظرة على TCP
    2. 18TCP sequence numbers and ACKsأرقام التسلسل والإقرار
  8. TCP reliable data transferالنقل الموثوق في TCP

    1. 19TCP reliable data transfer: sender eventsأحداث مرسل TCP
    2. 20TCP ACK generationتوليد الإقرار في TCP
    3. 21TCP fast retransmitإعادة الإرسال السريع
    1. 22TCP flow controlالتحكم في التدفق
  9. TCP connection managementإدارة اتصال TCP

    1. 23Connection management: the 3-way handshakeالمصافحة الثلاثية
    1. 24Principles of congestion controlمبادئ الازدحام
  10. TCP congestion controlالتحكم في ازدحام TCP

    1. 25TCP congestion control: AIMD and slow startAIMD والبداية البطيئة
    2. 26Reacting to loss; fairnessالاستجابة للفقد والعدالة
    1. 27الخلاصة