Bài giảng Computer Networking - Chapter 3: Transport Layer - Lê Ngọc Sơn
Chapter 3
Transport Layer
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a lot of work on our part. In return for use, we only ask the
following:
ꢀ If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!)
ꢀ If you post any slides in subst
you note that they are adapted fr
note our copyright of this material.
Computer Networking:
2009.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2009
J.F Kurose and K.W. Ross, All Rights Reserved
Transport Layer
3-1
Chapter 3: Transport Layer
Our goals:
ꢁ
learn about transport layer
protocols in the Internet:
ꢁ
understand principles
behind transport layer
services:
ꢁ
ꢁ
ꢁ
UDP: connectionless
transport
TCP: connection-oriented
transport
ꢁ
multiplexing/demultiple
xing
ꢁ
ꢁ
ꢁ
reliable data transfer
flow control
congestion control
TCP congestion control
Transport Layer
3-2
Chapter 3 outline
ꢁ
ꢁ
ꢁ
ꢁ
3.1 Transport-layer
services
3.2 Multiplexing and
demultiplexing
3.3 Connectionless
transport: UDP
ꢁ
3.5 Connection-oriented
transport: TCP
ꢁ
ꢁ
ꢁ
segment structure
reliable data transfer
ol
connection management
ꢁ
ꢁ
3.6 Principles of
control
3.4 Principles of reliable
data transfer
Transport Layer
3-3
Transport services and protocols
application
transport
netwo
data lin
physical
ꢁ
ꢁ
cung cấp truyền thông logic [logical
communication ] giữa các tiến trình
ứng dụng đang chạy trên các host
khác nhau.
Các giao thức vận chuyển chạy trên
các host
ꢁ
Phía gửi: chia message ở tầng
Transport thành các segments,
sau đó gửi các segment này
xuống tầng Network
application
transport
network
data link
physical
ꢁ
Phía nhận: ráp các segments
thành các message, sau đó gửi
lên tầng Application
ꢁ
Có nhiều hơn 2 giao thức vận
chuyển để các ứng dụng mạng sd
ꢁ
Internet: TCP và UDP
Transport Layer
3-4
Transport vs. network layer
Household analogy:
12 đứa trẻ gửi thư cho 12 đứa
trẻ khác.
ꢁ
ꢁ
Tầng Network: truyền
thông logic giữa các
hosts
Tầng Transport : truyền
thông logic giữa các
tiến trình
ꢁ
Tiến trình = đứa trẻ
ꢁ
Message ở tầng Ứng dụng =
thư trong phong bì
ꢁ
relies on, enhances,
ꢁ
ꢁ
hosts = gia đình
và Bill
network layer services
ꢁ
vụ bưu chính
Transport Layer
3-5
application
transport
ꢁ
Vận chuyển bảo đảm
[reliable], đúng thứ tự
network
data link
physical
ork
datk
[in-order] (TCP)
network
physi
data link
physical
ꢁ
ꢁ
ꢁ
congestion control
flow control
connection setup
network
data link
physical
twor
data link
physical
ꢁ
ꢁ
Vận chuyển ko bảo đảm
[unreliable], không đúng
network
data link
physical
appication
transport
network
data link
physical
M1
network
data link
physical
thứ tự : UDP
ꢁ
no-frills extension of “best-
effort” IP
Các dịch vụ ko cung cấp:
ꢁ
delay guarantees
ꢁ
bandwidth guarantees
Transport Layer
3-6
Slide 6
M1
no-frills: bình dân?
No-frills or no frills is a term used to describe any service or product for which the non-essential features have been removed to keep
the price low.
MVC, 5/3/2010
Chapter 3 outline
ꢁ
ꢁ
ꢁ
ꢁ
3.1 Transport-layer
services
3.2 Multiplexing and
demultiplexing
3.3 Connectionless
transport: UDP
ꢁ
3.5 Connection-oriented
transport: TCP
ꢁ
ꢁ
ꢁ
segment structure
reliable data transfer
ol
connection management
ꢁ
ꢁ
3.6 Principles of
control
3.4 Principles of reliable
data transfer
Transport Layer
3-7
Multiplexing/demultiplexing
Multiplexing ở host gửi:
Demultiplexing ở host nhận:
Chuyển segment nhận được đến
đúng socket
= socket
= process
P4
application
transport
network
link
P1
P2
P3
application
application
transport
network
transport
network
link
physical
physical
physical
host 3
host 2
host 1
Transport Layer
3-8
How demultiplexing works
Host bên nhận nhận IP datagrams
ꢁ
ꢁ
ꢁ
ꢁ
Mỗi datagram có source IP
address, destination IP address
Mỗi datagram mang 1 segment (là
đơn vị dữ liệu ở Tầng Transport)
Mỗi segment có source port
32 bits
source port # dest port #
other header fields
number, destination port number .
ꢁ
ꢁ
Host bên nhận sử dụng địa chỉ IP và
số hiệu port để chuyển giao segment
đến socket tương ứng.
Hai cách demultiplexing khác nhau
ứng với cách truyền thông hướng kết
data
nối (connection-oriented)và phi kết nối
(connectionless)
TCP/UDP segment format
Transport Layer
3-9
Connectionless demultiplexing
ꢁ
Khi host nhận được UDP
segment
ꢁ
Tạo sockets với số hiệu port:
DatagramSocket mySocket1 = new
DatagramSocket(12534);
ꢁ
Kiểm tra destination port
number trong segment
DatagramSocket mySocket2 = new
DatagramSocket(12535);
ꢁ
Chuyển UDP segment đến
socket tương ứng với số
hiệu port đó.
ꢂ
(
dest IP address, dest port number)
có cùng destination IP address và destination
port number, thì chúng cũng sẽ được chuyển đến
cùng 1 socket.
Transport Layer
3-10
Connectionless demux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428);
P1
P2
P3
SP: 6428
DP: 9157
SP: 6428
DP: 5775
SP: 9157
DP: 6428
SP: 5775
DP: 6428
client
IP: A
Client
server
IP: C
IP:B
SP: Source port number; DP: Destination port number
SP nhằm cung cấp “địa chỉ quay về”
Transport Layer
3-11
Connection-oriented demux
ꢁ
ꢁ
TCP socket được xác
định bằng bộ bốn:
ꢁ
Server host có thể cung
cấp nhiều TCP socket
đồng thời.
ꢁ
ꢁ
ꢁ
ꢁ
source IP address
source port number
dest IP addre
ꢁ
Mỗi socket được xác định
ốn của chính nó.
dest port number
ꢁ
Web server có các socket
kết nối đến.
Host bên nhận sử dụng
cả 4 giá trị này để
chuyển/hướng segment
tới socket tươ
mỗi request.
Transport Layer
3-12
(cont)
P3
P6
P2
P1
P4
P5
SP: 5775
0
SꢀIP: B
DꢀIP:C
SP: 9157
DP: 80
SꢀIP: A
DꢀIP:C
SP: 9157
DP: 80
SꢀIP: B
DꢀIP:C
client
IP: A
Client
server
IP: C
IP:B
Dù cho B và A vô tình sử dụng trùng 1 SP (9157), nhưng
Server C vẫn truyền thông chính xác với từng Client B, A do
chúng có S-IP khác nhau
Transport Layer
3-13
Threaded Web Server
P3
P2
P1
P4
SP: 5775
0
SꢀIP: B
DꢀIP:C
SP: 9157
DP: 80
SꢀIP: A
DꢀIP:C
SP: 9157
DP: 80
SꢀIP: B
DꢀIP:C
client
IP: A
Client
server
IP: C
IP:B
Vì lý do hiệu năng, Web Server sử dụng “một processs với
nhiều socket”. Khi đó, process sử dụng các sub-process (được
gọi là thread - tiểu trình), mỗi thread phụ trách 1 socket
Transport Layer
3-14
Chapter 3 outline
ꢁ
ꢁ
ꢁ
ꢁ
3.1 Transport-layer
services
3.2 Multiplexing and
demultiplexing
3.3 Connectionless
transport: UDP
ꢁ
3.5 Connection-oriented
transport: TCP
ꢁ
ꢁ
ꢁ
segment structure
reliable data transfer
ol
connection management
ꢁ
ꢁ
3.6 Principles of
control
3.4 Principles of reliable
data transfer
Transport Layer
3-15
UDP: User Datagram Protocol [RFC 768]
ꢁ
ꢁ
Là giao thức vận chuyển đơn
giản.
UDP segments có thể bị:
ꢁ
Mất
ꢁ
Chuyển giao cho các ứng
dụng ko đúng thứ tự
ꢁ
Phi kết nối [connectionless]:
ꢁ
Trong UDP, ko có “thủ
tục bắt tay” giữa bên gửi
và bên nhận.
Mỗi UDP segment được
xử lý độc lập với các
segments khác.
ꢁ
Transport Layer
3-16
UDP: more
ꢁ
Thường được các ứng dụng
streaming multimedia sử
dụng, do chúng
32 bits
source port # dest port #
ꢁ
Cho phép mất d/liệu
checksum
length
ꢁ
Cần tốc độ (cao) ổn định
Length, in
bytes of UDP
segment,
ꢁ
Các ứng dụng khác
dùng UDP
ꢁ
DNS
including
data
header
ꢁ
SNMP
ꢁ
Truyền d/liệu bảo đảm với
UDP: cần bổ sun
phát hiện và sửa lỗi ở
tầng Ứng dụng.
UDP segment format
Transport Layer
3-17
UDP checksum
Mục đích: phát hiện “lỗi” (e.g., flipped bits) trong các
segment được truyền theo UDP.
Bên nhận:
ꢁ
Bên gửi:
Tính lại checksum của segment
nhận được.
ꢁ
Coi nội dung segment như
chuỗi các số nguyên 16 bit.
ꢁ
Kiểm tra trị tính được có bằng
ꢁ
ꢁ
Checksum: bù 1 của tổng
các số nguyên 16 bit (trong
nội dung segment)
Bên gửi đặt trị checksum
vào trường checksum trong
UDP segment.
ꢁ
phát hiện
ꢁ
phát hiện (nhưng vẫn có
thể có lỗi).
Transport Layer
3-18
ꢁ
ꢁ
Ghi chú
•
Khi cộng, bít nhớ ở ngoài cùng bên trái cần được
thêm vào kết quả=> tạo thành Tổng.
Ví dụ: cộng 2 số nguyên 16-bit.
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
Tổng
1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Checksum
(bù 1 của Tổng)
Transport Layer
3-19
Tải về để xem bản đầy đủ
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Computer Networking - Chapter 3: Transport Layer - Lê Ngọc Sơn", để tải tài liệu gốc về máy hãy click vào nút Download ở trên
File đính kèm:
bai_giang_computer_networking_chapter_3_transport_layer_le_n.pdf

