Computer Networks: Maarten Van Steen
Computer Networks: Maarten Van Steen
Chapter 06
(version June 8, 2007)
01 Introduction
02 Physical Layer
03 Data Link Layer
04 MAC Sublayer
05 Network Layer
06 Transport Layer
07 Application Layer
08 Network Security
00 – 1 /
Application Application
(or session) Application/transport (or session)
layer Transport interface layer
address
TPDU
Transport Transport
entity Transport entity
protocol
Network
address Transport/network
Network layer interface Network layer
Connection-Oriented Socket
Communication
SERVER CLIENT
socket() socket()
bind()
listen()
accept() connect()
write()
read()
write()
read()
close() close()
TPDU payload
Packet payload
Frame payload
PASSIVE ACTIVE
ESTABLISHMENT ESTABLISHMENT
PENDING PENDING
Disconnection Disconnect
request TPDU primitive
PASSIVE received ACTIVE
executed
DISCONNECT DISCONNECT
PENDING PENDING
IDLE
Disconnect Disconnection request
primitive executed TPDU received
Physical
communication channel Host
(a) (b)
• explicit addressing
Addressing
Note: Each layer has its own way of dealing with ad-
dresses. In IP, a transport service access point is
an IP address with a port number.
Host 1 Host 2
Server 1 Server 2
Application TSAP 1208 Application
process layer
Transport
Transport layer TSAP 1522 TSAP1836
connection
NSAP Network
layer NSAP
Data link
layer
Physical
layer
Time-
of-day
Layer server
4
TSAP
(a) (b)
Service Locations
Unknown Addresses
2k–1
Forbidden T T
message
Sequence numbers
120
Sequence numbers
n
on de
gi id
re orb
F
80
70
Restart after
60 crash with 70
Actual sequence
numbers used
0
0 30 60 90 120 150 180
Time Time
(a) (b)
Error-Free Connection
Establishment (1/2)
= x) = x)
ACK ACK
Time
= y, eq = y,
eq
ACK (s AC K (s
DAT
A (s REJEC
eq = T (AC
x, AC K = y)
K=
y)
(a) (b)
Host 1 Host 2
CR (s
eq =
x)
Old duplicate
x )
CK=
,A
=y
seq
K(
AC
DAT
A (s
ACK eq = x,
= z)
Old duplicate
REJ
ECT
(ACK
= y)
(c)
Host 1 Host 2
CR
ACK
DATA
Time
DATA
DR
No data are
delivered after
a disconnect
request
Send DR Send DR
+ start timer
DR DR + start timer
Release Release
connection connection
(a) (b)
(c) (d)
Buffer Reservation
Basic idea: The sender requests a number of buffers
at the receiver’s side when opening a connection. The
receiver responds with a credit grant. After that, the
receiver grants more credit when bufferspace becomes
available:
A Message B Comments
Multiplexing
Basic idea 1: Assuming that the network offers only a
limited number of virtual circuits, or that a user doesn’t
want to pay so much, then use a single circuit for sev-
eral connections ⇒ upward multiplexing.
Transport address
Layer
Network
4 address
2 Router lines
To router
(a) (b)
Strategy used by
sending host AC(W) AWC C(AW) C(WA) W AC WC(A)
State of a Connection
IDLE Not yet established
WAITING CONNECT called; CALL REQ. sent
QUEUED CALL REQ. arrived; LISTEN not called
ESTABLISHED Connection established
SENDING Waiting for permission to send TPDU
RECEIVING RECEIVE has just been called
DISCONNECTING DISCONNECT ahs just been called
P4: A5/Idle
DISCONNECT P4: A6/Disc
P5: A7/Estab
SEND P5: A8/Send
RECEIVE A9/Receiving
P3: A1/Estab
Call_req P3: A4/Queu'd
Call_acc ∼/Estab
Incoming packets
Clear_conf ∼/Idle
DataPkt A12/Estab
Timeout ∼/Idle
Predicates Actions
P1: Connection table full A1: Send Call_acc A7: Send message
P2: Call_req pending A2: Wait for Call_req A8: Wait for credit
P3: LISTEN pending A3: Send Call_req A9: Send credit
P4: Clear_req pending A4: Start timer A10: Set Clr_req_received flag
P5: Credit available A5: Send Clear_conf A11: Record credit
A6: Send Clear_req A12: Accept message
CONNECT TIMEOUT
IDLE
DISCONNECT
CALL REQ
LISTEN,
WAITING QUEUED
SEND DATA,
SENDING RECEIVING
CLEAR REQ
DISCON-
NECTING
UDP
32 Bits
Client Server
1 5
stub stub
Client
Server
2 4
Operating system Operating system
Network
RTP
Problem: Can we support multimedia streaming over
the Internet? The Real-Time Transport Protocol pro-
vides some best-effort support.
Ethernet IP UDP RTP
Multimedia application header header header header
User
space RTP
Socket interface RTP payload
UDP
OS
IP UDP payload
Kernel
Ethernet IP payload
Ethernet payload
(a) (b)
TCP Header
32 Bits
Sequence number
Acknowledgement number
TCP U A P R S F
header R C S S Y I Window size
length G K H T N N
Data (optional)
RST/– SEND/SYN
SYN SYN
RCVD SENT
SYN/SYN + ACK (simultaneous open)
CLOSE/FIN FIN/ACK
(Active close) (Passive close)
FIN/ACK
FIN CLOSE
CLOSING
WAIT 1 WAIT
FIN + ACK/ACK
FIN TIME LAST
WAIT 2 WAIT ACK
FIN/ACK
(Timeout/)
ACK/–
CLOSED
2K
ACK = 2048 WIN = 2048
Application
does a 2K
write 2K SEQ = 2048
Full
Sender is Application
IN = 0
blocked 4096 W reads 2K
ACK =
048
IN = 2
4096 W
ACK =
2K
Sender may
send up to 2K
1K
SEQ =
4096
1K 2K
36
Threshold
32
Congestion window (kilobytes)
28
24 Threshold
20
16
12
0
0 2 4 6 8 10 12 14 16 18 20 22 24
Transmission number
0.2 0.2
Probability
Probability
0.1 0.1
0 0
0 10 20 30 40 50 0 10 20 30 40 50
Round-trip time (msec) Round-trip time (msec)
(a) (b)
Wireless TCP
Problem: TCP assumes that IP is running across
wires. When packets are lost, TCP assumes this is
caused by congestion and slows down. In wireless
environments, packets get lost due reliability issues.
In those cases, TCP should do the opposite: try harder.
Mobile
host
Router Antenna