Lecture 5 Transport Layer
Lecture 5 Transport Layer
Lecture 5 Transport Layer
Transport Layer
Computer
Networking: A
Top Down
Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
different hosts
lo
gi
transport protocols run in
ca
l
end systems
en
d-
en
send side: breaks app
d
tra
messages into segments,
ns
po
passes to network layer
rt
rcv side: reassembles application
lo
data link physical
flow control
gi
physical
ca
network
l
data link
en
connection setup physical
d-
en
unreliable, unordered
network
d
tra
data link
physical
ns
delivery: UDP
po
network
data link
rt
no-frills extension of network
data link
physical
application
“ best-effort” IP physical
network transport
data link network
services not available: physical data link
physical
delay guarantees
bandwidth guarantees
application
length checksum
why is there a UDP?
no connection
application establishment (which can
data add delay)
(payload) simple: no connection
state at sender, receiver
small header size
UDP segment format
no congestion control:
UDP can blast away as
fast as desired
Transport Layer 3-12
UDP checksum
Goal: detect “ errors” (e.g., flipped bits) in
transmitted segment
sender: receiver:
treat segment contents, compute checksum of
including header fields, received segment
as sequence of 16-bit check if computed checksum
integers equals checksum field value:
checksum: addition NO - error detected
(one’s complement sum) YES - no error detected.
of segment contents But maybe errors
sender puts checksum nonetheless? More later ….
value into UDP
checksum field
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeo
ACK=100
ut
ut
X
ACK=100
ACK=120
SendBase=120
X
ut
ACK=120
cumulative ACK
Transport Layer 3-22
Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 multiplexing and segment structure
demultiplexing reliable data transfer
3.3 connectionless flow control
transport: UDP connection management
3.4 principles of reliable 3.6 principles of congestion
data transfer control
3.7 TCP congestion control
IP
code
flow control
receiver controls sender, so
sender won’t overflow receiver’s from sender
buffer by transmitting too much,
too fast receiver protocol stack
2-way handshake:
Q: will 2-way handshake
always work in network?
variable delays
Let’s talk retransmitted messages (e.g.
ESTAB req_conn(x)) due to message
OK
ESTAB loss
message reordering
can’t “ see” other side
choose x
req_conn(x)
ESTAB
acc_conn(x)
ESTAB
choose x choose x
req_conn(x) req_conn(x)
ESTAB ESTAB
retransmit acc_conn(x) retransmit acc_conn(x)
req_conn(x) req_conn(x)
ESTAB ESTAB
data(x+1) accept
req_conn(x)
retransmit data(x+1)
data(x+1)
connection connection
client x completes server x completes server
client
terminates forgets x terminates forgets x
req_conn(x)
ESTAB ESTAB
data(x+1) accept
half open connection! data(x+1)
(no client!)
Transport Layer 3-27
TCP 3-way handshake
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