Chapter 5 - Transport Layer
Chapter 5 - Transport Layer
Transport layer
Reading 6.2, 6.3, 6.4, 6.5
Computer Networks, Tanenbaum
1
Contents
2
Transport layer in OSI model
Network
Routing and forwarding data between
(IP, ICMP…) hosts
Datalink
(Ethernet, ADSL…)
Physical
(bits…)
3
Principle of transport layer (1)
application
lGet applications/processes to transport
network
communicate to each other data link
physical
lSender:
l Receives data from application
log
ica
l Place data in segments and give
l
en
to network layer
d-
en
l If the data size is too big, it is
d
tra
divided into many segments
ns
po
lReceiver:
rt
l Receives segments from application
network layer transport
network
l Reconstitute data from data link
application
4
Principle of transport layer (2)
application
transport
end systems
physical
network
data link
log
network
ica
physical
switches…
l en
d-
en
• Two kinds of transport layer
d
network
tra
data link
services
ns
physicalnetwork
po
data link
rt
physical
• Reliable, connection-oriented, network
data link
e.g TCP physical network
data link
application
transport
network
• Not reliable, connectionless, physical data link
physical
e.g. UDP
5
Why two kinds of service?
6
Applications and transport services
7
Functionalities
MUX/DEMUX
8
Mux/Demux
Application
protocols
HTTP FTP Chat HTTP FTP Chat
Transport
Multiplexing Demultiplexing
protocols
Network protocols
9
How does it Mux/Demux?
32 bits
lHow to distinguish source port # dest port #
applications running in the
same hosts? other header fields
lUse an identifier called port
number (16 bits)
lEach process is assigned a port
application
lSocket: A pair of IP address data
and port (message)
lSocket identifies an unique
application process all over the
world TCP/UDP segment format
10
UDP
User Datagram Protocol
11
“Best effort” protocols
lWhy UDP?
lNo need to establish connection (cause delay)
lSimple
lSmall header
lNo congestion control à send data as fast as possible
12
Datagram format
Length of the
datagram in
byte
Application
data
(message)
13
Issues of UDP
• No congestion control
• Cause overload of the Internet
• No reliability
• Applications have to implement themselves
mechanisms to control errors
14
TCP
Transmission Control Protocol
TCP segment structure
Connection management
Flow control
Congestion control
15
Overview of TCP
lConnection oriented
l3 steps hand-shake
lData transmission in stream of byte, reliable
lUse buffer
lTransmit data in pipeline
lIncrease the performance
lFlow control
lSliding windows
lCongestion control
lDetect congestion and solve
16
TCP segment
32 bits
URG: urgent data - For reliable
source port # dest port #
transmission
sequence number
ACK: ACK #
acknowledgement number
head not
PSH: data needs to len used
UAP R S F Receive window
-For flow control
be sent immediately checksum Urg data pnter -with sliding window
RST, SYN, FIN: Options (variable length)
Flag for special
segment
application
data
(variable length)
17
How TCP provide reliable service?
18
Acknowledgement in TCP
Seq. #:
lIndex of the first byte Host A Host B
of the segment in the
data stream User Seq=4
2, ACK
types =79, d
ata =
ACK: ‘Hello’ ‘Hello
’
host ACKs
lThe index of the first ’
receipt of
rld
byte expected to data = ‘WoHello’, Send back
47, back ‘World’
receive from the 79, ACK=
Seq=
other-side
lImplicitly to confirm host ACKs
that the ACK senders receipt Seq=?
of send , ACK=
have received well ‘Bye’
?
previous bytes
time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
simple telnet scenario
School of Information and Communication Technology
Before this transmission: A has sent 41 bytes to B,
and B has sent 78 bytes to A 19
Connection establishing in TCP : 3 steps
20
Close connection
timed wait
closed
closed
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
21
Symplified life cycle of TCP
Client application
Initiates a TCP connection Server application
Creates a listen socket
CLOSED
Wait 30 sec. Receive ACK
CLOSED
Send nothing
Send SYN
Send FIN
Receive ACK
Send nothing Receive FIN Receive ACK
FIN_WAIT_1 Send ACK ESTABLISHED Send nothing
Client application
Initiates close connection
22
Flow control in TCP
23
Flow control(1)
A A B
B
Slow Overload
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
24
Flow control (2)
25
Flow control TCP
26
Information exchanged on Rwnd
A B
l Receiver inform
regularly to senders
data
the value of Rwnd in
acknowledgment
wnd = 100) segments
ACK (r
data
27
Congestion control in TCP
28
Overview of Congestion control
Congestion
occur
29
Principles of congestion control
lSlow-start
lIncreases the transmission
speed in exponential order cwnd
lCongestion avoidance 18
Threshold=16
lIncrease the transmission
16
congestion is detected 12 SS
10
congestion? 6
30
TCP Slow Start (1)
• Main idea
• Cwnd: congestion window = data size that source can send to
destination without waiting for ACK
• Rwnd (sliding windows in flow control): maximum data size to be
sent without ACK according to flow control
• Actual data size can be sent without ACK = min (Cwnd, Rwnd)
• Initiate cwnd =1 MSS (Maximum segment size)
• Increase cwnd =+1 MSS after each reception of a ACK packet
from the receiver.
• Increase slowly but the speed increase in exponential order
• Increase until a threshold: ssthresh
• After that TCP move to congestion avoidance period
31
TCP Slow Start (2)
Host A Host B
one segm
ent
RTT
two segme
nts
four segm
ents
time
32
Congestion avoidance
Host A Host B
• Main idea
• Increase cwnd in one segm
ent
additional order
RTT
until cwnd reaches
two segme
to congestion nts
time
33
TCP reaction in congestion situation (1)
34
TCP reaction in congestion situation(2)
35
Congestion control – illustration
cwnd
22
Timeout
20
18
Threshold=16 Threshold is set to half of cwnd (20)
16 And slow start starts
14
Congestion 3 ACKs
12 Slow avoidance
start Threshold=10 Threshold is set to half of cwnd (12)
10
And additive increase starts
8
Slow start
6 Congestion Threshold=6
avoidance
4
Congestion
2 avoidance
Step
36
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
Exercise
37
Exercise
39