Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter3 Part2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Chapter 3 outline

3.1 transport-layer services 3.5 connection-oriented


3.2 multiplexing and demultiplexingtransport: TCP
3.3 connectionless transport: UDP  segment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer3-1
TCP: Overview RFCs: 793,1122,1323, 2018, 2581

 point-to-point:  full duplex data:


 one sender, one  bi-directional data
receiver flow in same
 reliable, in-order connection
byte steam:  MSS: maximum
 no “message segment size
boundaries”  connection-
 pipelined: oriented:
 TCP congestion and  handshaking
flow control set (exchange of control
window size msgs) inits sender,
receiver state before
data exchange Transport Layer3-2
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UAP R S F receive window
(generally not used) # bytes
checksum Urg data pointer
rcvr willing
RST, SYN, FIN: to accept
options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)

Transport Layer3-3
TCP seq. numbers, ACKs
outgoing segment from sender
sequence numbers: source port # dest port #
sequence number
byte stream “number” acknowledgement number
rwnd
of first byte in checksum urg pointer

segment’s data window size


N
acknowledgements:
seq # of next byte
sender sequence number space
expected from other
side sent sent, not- usable not
ACKed yet ACKed but not usable
cumulative ACK (“in-flight”) yet sent

Q: how receiver handles out- incoming segment to sender


of-order segments source port # dest port #
sequence number
A: TCP spec doesn’t acknowledgement number
A
say, - up to checksum
rwnd
urg pointer

implementor Transport Layer3-4


TCP seq. numbers, ACKs
Host A Host B

User
types
‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80

simple telnet scenario

Transport Layer3-5
TCP reliable data transfer
 TCP creates rdt
service on top of IP’s
unreliable service
 pipelined segments let’s initially consider
 cumulative acks simplified TCP
 single retransmission sender:
timer  ignore duplicate acks
 retransmissions  ignore flow control,
triggered by: congestion control
 timeout events
 duplicate acks
Transport Layer3-6
TCP sender events:
data rcvd from app: timeout:
 create segment with  retransmit segment
seq # that caused timeout
 seq # is byte-stream  restart timer
number of first data ack rcvd:
byte in segment  if ack
 start timer if not
acknowledges
already running previously unacked
 think of timer as for segments
oldest unacked  update what is
segment known to be ACKed
 expiration interval:  start timer if there
TimeOutInterval
are still unacked Transport Layer3-7
TCP: retransmission scenarios
Host A Host B Host A Host B

SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeout

timeout
Seq=100, 20 bytes of data
ACK=100
X
ACK=100
ACK=120

Seq=92, 8 bytes of data Seq=92, 8


SendBase=100 bytes of data
SendBase=120
ACK=100
ACK=120

SendBase=120

lost ACK scenario premature timeout


Transport Layer3-8
TCP: retransmission scenarios
Host A Host B

Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


timeout

ACK=100
X
ACK=120

Seq=120, 15 bytes of data

cumulative ACK
Transport Layer3-9
TCP ACK generation [RFC 1122, RFC 2581]
event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK

arrival of in-order segment with immediately send single cumulative


expected seq #. One other ACK, ACKing both in-order segments
segment has ACK pending

arrival of out-of-order segment immediately send duplicate ACK,


higher-than-expect seq. # . indicating seq. # of next expected byte
Gap detected

arrival of segment that immediate send ACK, provided that


partially or completely fills gap segment starts at lower end of gap

Transport Layer3-10
TCP fast retransmit
 time-out period
TCP fast retransmit
often relatively
long: if sender receives 3
ACKs for same data
 long delay before
resending lost (“triple
(“triple duplicate
duplicate ACKs”),
ACKs”),
packet resend unacked
segment with smallest
 detect lost seq #
segments via  likely that unacked
duplicate ACKs. segment lost, so don’t
 sender often sends wait for timeout
many segments
back-to-back
 if segment is lost, Transport Layer3-11
TCP fast retransmit
Host A Host B

Seq=92, 8 bytes of data


Seq=100, 20 bytes of data
X

ACK=100

timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data

fast retransmit after sender


receipt of triple duplicate ACK
Transport Layer3-12
TCP: closing a connection
 client, server each close their side of
connection
 send TCP segment with FIN bit = 1
 respond to received FIN with ACK
 on receiving FIN, ACK can be combined with
own FIN
 simultaneous FIN exchanges can be
handled

Transport Layer3-13
TCP: closing a connection
client state server state
ESTAB ESTAB
clientSocket.close()
FIN_WAIT_1 can no longer FINbit=1, seq=x
send but can
receive data CLOSE_WAIT
ACKbit=1; ACKnum=x+1
can still
FIN_WAIT_2 wait for server send data
close

LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime

CLOSED

Transport Layer3-14

You might also like