Title: Reliable data transfer and its implementation in TCP Announcements: Quiz
1Reliable data transfer and its implementation in
TCPAnnouncements Quiz 1 and homework 3
EECS 325/425, Fall 2005 September 30
2Previous lecture Go-Back-N
- Sender
- sliding window of up to N consecutive unacked
packets allowed - multiple-bit sequence number in packet header
- ACK(n) ACKs all packets up to, including
sequence number n - cumulative ACK - may receive duplicate ACKs (see receiver)
- keep a timer for each in-flight packet
- timeout(n) retransmit packet n and all higher
sequence number packets in window
3GBN in action
4Selective Repeat
- receiver individually acknowledges all correctly
received packets - buffers packets, as needed, for eventual in-order
delivery to upper layer - sender only resends packets for which ACK not
received - sender timer for each unACKed pkt
- sender window
- N consecutive sequence numbers
- again limits sequence numbers of sent, unACKed
pkts
5Selective repeat sender, receiver windows
6Selective repeat
- packet n in rcvbase, rcvbaseN-1
- send ACK(n)
- out-of-order buffer
- in-order deliver (also deliver buffered,
in-order packets), advance window to next
not-yet-received packet - packet n in rcvbase-N,rcvbase-1
- ACK(n)?
- otherwise
- ignore
- data from above
- if next available sequence number in window, send
packet - timeout(n)
- resend packet n, restart timer
- ACK(n) in sendbase,sendbaseN
- mark packet n as received
- if nsmallest unACKed packet, advance window base
to next unACKed sequence number
7Selective repeat in action
8Selective repeat dilemma
- Example
- seq s 0, 1, 2, 3
- window size3
- receiver sees no difference in two scenarios!
- incorrectly passes duplicate data as new in (a)
- Q what relationship between seq size and
window size?
9Chapter 3 outline
- 3.1 Transport-layer services
- 3.2 Multiplexing and demultiplexing
- 3.3 Connectionless transport UDP
- 3.4 Principles of reliable data transfer
- 3.5 Connection-oriented transport TCP
- segment structure
- reliable data transfer
- flow control
- connection management
- 3.6 Principles of congestion control
- 3.7 TCP congestion control
10TCP Overview RFCs 793, 1122, 1323, 2018, 2581
- point-to-point
- one sender, one receiver
- reliable, in-order byte steam
- no message boundaries
- pipelined
- TCP congestion and flow control set window size
- send receive buffers
- full duplex data
- bi-directional data flow in same connection
- MSS maximum segment size
- connection-oriented
- handshaking before data exchange
- flow controlled
- sender will not overwhelm receiver
11TCP segment structure
URG urgent data (generally not used)
counting by bytes of data (not segments!)
ACK ACK valid
PSH push data now (generally not used)
bytes rcvr willing to accept
RST, SYN, FIN connection estab (setup,
teardown commands)
Internet checksum (as in UDP)
12TCP seq. s and ACKs
- Seq. s
- byte stream number of first byte in segments
data - ACKs
- seq of next byte expected from other side
- cumulative ACK
- Q how receiver handles out-of-order segments
- A TCP spec doesnt say, - up to implementor
Host B
Host A
User types C
Seq42, ACK79, data C
host ACKs receipt of C, echoes back C
Seq79, ACK43, data C
host ACKs receipt of echoed C
Seq43, ACK80
simple telnet scenario
13TCP reliable data transfer
- TCP creates Rdt service on top of IPs unreliable
service - Techniques used
- Checksum, cumulative ACKs, sequence number, timer
- Pipelined segments
- TCP uses a single retransmission timer (to reduce
overhead)
- Cumulative ACKs
- GBN or SR?
- Retransmissions are triggered by
- timeout events
- duplicate ACKs
- Initially consider simplified TCP sender
- ignore duplicate ACKs (later this lecture)
- ignore flow control, congestion control (next
week)
14TCP sender (3 events)
- data received from app
- Create segment with sequence number
- Sequence number is byte-stream number of first
data byte in the segment - start timer if not already running (think of
timer as for oldest un-acked segment) - expiration interval TimeOutInterval
- estimated value
- Ack received
- If acknowledges previously un-acked segments
- update what is known to be acked
- start timer if there are outstanding segments
- timeout
- retransmit segment that caused timeout
- restart time
15TCP sender(simplified)
NextSeqNum InitialSeqNum
SendBase InitialSeqNum loop (forever)
switch(event) event
data received from application above
create TCP segment with sequence number
NextSeqNum if (timer currently
not running) start timer
pass segment to IP
NextSeqNum NextSeqNum length(data)
event timer timeout
retransmit not-yet-acknowledged segment with
smallest sequence number
start timer event ACK
received, with ACK field value of y
if (y gt SendBase)
SendBase y if (there are
currently not-yet-acknowledged segments)
start timer
/ end of loop forever /
- Comment
- SendBase-1 last
- cumulatively acked byte
- Example
- SendBase-1 71y 73, so the rcvrwants 73
y gt SendBase, sothat new data is acked
16TCP retransmission scenarios
Host A
Host B
Seq92, 8 bytes data
Seq100, 20 bytes data
ACK100
ACK120
Seq92, 8 bytes data
Sendbase 100
SendBase 120
ACK120
Seq92 timeout
SendBase 100
SendBase 120
premature timeout
17TCP retransmission scenarios (more)
SendBase 120