Bài giảng Computer Networking - Chapter 2: Application Laye - Lê Ngọc Sơn

Chapter 2  
Application 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 from (or perhaps identical to) our slides, and  
note our copyright of this material.  
Computer Networking:  
A Top Down Approach,  
5th edition.  
Jim Kurose, Keith Ross  
ddisonꢀWesley, April  
2009.  
Thanks and enjoy! JFK/KWR  
All material copyright 1996-2009  
J.F Kurose and K.W. Ross, All Rights Reserved  
2: Application Layer  
1
2: Application Layer  
2
Chapter 2: Application layer  
ꢁ 2.1 Principles of  
ꢁ 2.6 P2P applications  
network applications  
ꢁ 2.2 Web and HTTP  
ꢁ 2.3 FTP  
ꢁ 2.7 Socket programming  
with UDP  
ꢁ 2.8 Socket programming  
with TCP  
ꢁ 2.4 Electronic Mail  
ꢁ SMTP, POP3, IMAP  
ꢁ 2.5 DNS  
2: Application Layer  
3
Chapter 2: Application Layer  
Our goals:  
ꢁ conceptual,  
ꢁ learn about protocols  
by examining popular  
applicationꢀlevel  
protocols  
implementation  
aspects of network  
application protocols  
HTTP  
ꢁ FTP  
ꢁ transportꢀlayer  
ꢁ SMTP / POP3 / IMAP  
ꢁ DNS  
service models  
ꢁ clientꢀserver  
paradigm  
ꢁ peerꢀtoꢀpe
ꢁ programming network  
applications  
ꢁ socket API  
paradigm  
2: Application Layer  
4
Some network apps  
ꢁ eꢀmail  
ꢁ web  
ꢁ social networks  
ꢁ voice over IP  
ꢁ instant messaging  
ꢁ remote login  
ꢁ P2P file sharing  
ꢁ realꢀtime video  
conferencing  
ꢁ grid computing  
ꢁ multiꢀuser network  
games  
ꢁ streaming stored video  
clips  
2: Application Layer  
5
Tạo ra một ứng dụng mạng, nghĩa là:  
application  
transport  
network  
data link  
physical  
viết chương trình sao cho:  
ꢁ Có thể chạy trên các host khác  
nhau.  
ꢁ Có thể truyền thông với nhau qua  
mạng  
ꢁ
e.g., web se
communicates with browser  
software  
application  
transport  
network  
data link  
application  
physical  
không cần phải viết các phần  
mềm chạy trên thiết bị mạng  
(router, switc
transport  
network  
data link  
physical  
ꢁ Các thiết bị mạng ko chạy các  
apps do nguời dùng viết  
ꢁ Lối này cho phép phát triển nhanh  
các apps chạy trên các host.  
2: Application Layer  
6
Chapter 2: Application layer  
ꢁ 2.1 Principles of  
ꢁ 2.6 P2P applications  
network applications  
ꢁ 2.2 Web and HTTP  
ꢁ 2.3 FTP  
ꢁ 2.7 Socket programming  
with UDP  
ꢁ 2.8 Socket programming  
with TCP  
ꢁ 2.4 Electronic Mail  
ꢁ SMTP, POP3, IMAP  
ꢁ 2.5 DNS  
2: Application Layer  
7
Application architectures  
ꢁ Kiến trúc ứng dụng là yếu tố phải quyết định  
trước tiên khi xây dựng ứng dụng mạng  
ꢁ Clientꢀserver  
ꢁ Including data centers / cloud computing  
ꢁ Peerꢀtoꢀpeer (P2P)  
ꢁ Hybrid of clientꢀserver and P2P  
ꢁ Kiến trúc ứng dụng ≠ kiến trúc mạng (VD  
Internet có kiến trúc phân tầng!)  
2: Application Layer  
8
Clientꢀserver architecture  
server:  
ꢂ alwaysꢀon host  
ꢂ địa chỉ IP cố định  
ꢂ Sử dụng server farms khi tải  
lớn  
clients:  
ꢂ Truyền thông với server  
ꢂ Có thể kết nối không liên  
client/server  
tục  
ꢂ Có thể sử dụng địa chỉ IP  
ꢂ Không truyền thông trực  
tiếp với nhau.  
2: Application Layer  
9
Google Data Centers  
ꢁ
ꢁ
ꢁ
Pure P2P architecture  
ꢁ Ko dùng server  
ꢁ Các host truyền thông  
trực tiếp với nhau  
peerꢀpeer  
ꢁ Các peer có thể kết nối  
ko liên tục và thay đổi địa  
chỉ IP  
VD: Gnutella – ứng dụng  
nguồn mở cho phép chia  
sẻ file  
Có tính mở rộng cao nhưng  
khó quản lý.  
2: Application Layer  
11  
Hybrid of clientꢀserver and P2P  
Skype  
ꢂ Là ứng dụng truyền âm trên mạng IP (VoIP)  
ꢂ Server trung tâm:tìm địa chỉ của bên thứ 3  
ꢂ Kết nối clientꢀclient là trực tiếp, ko qua Server  
Instant messaging  
ꢂ
Dùng để t
g  
ꢂ Dhiịệcnh dviụệnc/evnịttrraíliczủead csleiervnitce: phát hiện/định vị sự  
• User đăng ký địa chỉ IP của nó với server trung  
tâm mỗi khi online  
• User liên lạc với server trung tâm để tìm địa chỉ  
IP của bạn chat.  
2: Application Layer  
12  
Processes communicating  
Tiến trình client : tiến trình  
Tiến trình (process):  
chương trình chạy trên 1  
host.  
ꢁ Trên cùng host, 2 tiến  
trình truyền
nhau sử dụng interꢀ  
process communication  
(được hệ điều hành định  
nghĩa ).  
ꢁ Các tiến trình
host khác nhau truyền  
thông nhau bằng trao đổi  
thông điệp (messages)  
khởi tạo truyền thông  
Tiến trình server: tiến  
trình chờ đợi được liên  
• Lưu ý: các ứng dụng P2P  
có cả tiến trình client lẫn  
server.  
2: Application Layer  
13  
Sockets  
host or  
server  
host or  
server  
ꢁ Các tiến trình gửi/nhận các  
thông điệp đến/từ socket  
của nó  
ꢁ Tiến trình~ “ngôi nhà” =>  
controlled by  
app developer  
process  
socket  
process  
socket ~ “cửa
ꢂ Tiến trình đẩy thông điệp ra  
TCP with  
buffers,  
variables  
TCP with  
buffers,  
variables  
Internet  
“cửa”.  
ꢂ Hạ tầng vận chuyển ở “bên  
ngoài cửa” chuyển giao thông  
điệp tới socket của tiến trình  
bên nhận.  
controlled  
ꢁ API: (1) choice of transport protocol; (2) ability to fix  
a few parameters (lots more on this later)  
2: Application Layer  
14  
Addressing processes  
ꢁ Q: liệu địa chỉ IP của host  
ꢁ Để nhận thông điệp, tiến  
trình phải có định danh  
(identifier)  
mà process đang chạy trên  
đó, có đủ để xác định tiến  
trình?  
ꢁ A: Không đủ, vì có có  
nhiều tiến trình có thể  
chạy trên cùng host.  
ꢁ Các host đều có 1 địa chỉ  
IP dài 32 bit, duy nhất.  
ꢁ Định danh bao gồm cả địa  
chỉ IP và số hiệu cổng (port  
ipconfig từ console, lấy number) được liên kết với  
ꢁ Bài tập: dùng lệnh  
tiến trình trên host.  
ꢁ Ví dụ về các port number:  
ꢁ HTTP server: 80  
địa chỉ IP trên máy tính  
Windows.  
ꢁ Mail server: 25  
2: Application Layer  
15  
Appꢀlayer protocol defines  
Các giao thức công hữu:  
ꢁ Được định nghĩa ở RFCs  
ꢁ Các kiểu thông điệp được  
trao đổi,  
ꢁ e.g., request, response  
ꢁ HTTP: RFC 2616  
ꢁ Ký pháp thông điệp:  
ꢁ Cho phép làm việc phối  
ꢁ
Các field trê
hợp.  
và mô tả của từng field.  
ꢁ e.g., HTTP, SMTP,  
BitTorrent  
Các giao thức tư hữu:  
ꢁ Ngữ nghĩa thông điệp  
ꢁ Ý nghĩa của thông tin trên  
từng field  
pe, ppstream  
ꢁ Các quy tắc vthời điểm  
và cách thức các tiến  
trình gửi và phản hồi lại  
các thông điệp.  
2: Application Layer  
16  
What transport service does an app need?  
Băng thông  
Mất dữ liệu  
ꢁ Một số ứng dụng (VD audio)  
có thể chấp nhận mất dữ  
liệu.  
ꢁ Các ứng dụng khác (e.g., file  
transfer, telnet) đòi hỏi phải  
truyền dữ liệu chính xác  
tuyệt đối  
• Vài ứng dụng (e.g.,  
multimedia) cần băng  
thông tối thiểu để đạt hiệu  
quả.  
dụng khác  
(“elastic apps”) có thể thích  
nghi với băng thông hiện  
có (VD email, truyền file,…)  
Kịp thời  
ꢁ Một số ứng dụng (e.g.,  
Internet telephony,  
interactive games) đòi  
hỏi độ trễ thấp ở mức  
chấp nhận được.  
An toàn  
• Mã hóa, toàn vẹn dữ liệu,  
…
2: Application Layer  
17  
Transport service requirements of common apps  
Kꢆp thꢇi  
Loꢀi ꢁng dꢂng  
Mꢃt dꢄ liꢅu Băng thông  
no  
no  
no  
file transfer  
e-mail  
Web documents  
real-time audio/video  
no loss  
no loss  
no loss  
elastic  
elastic  
elastic  
yes, 100’s msec  
loss-tolerant audio: 5kbps-1Mbps  
video:10kbps-5Mbps  
yes, few secs  
yes, 100’s msec  
yes and no  
stored audio/video  
interactive games  
instant messaging  
loss-tolerant same as above  
loss-tolerant few kbps up  
no loss  
elastic  
2: Application Layer  
18  
Internet transport protocols services  
TCP service:  
ꢁ connectionꢀoriented: cần quá trình  
thiết lập kết nối ( “handshake”)  
giữa các tiến trình server và client  
ꢁ Vận chuyển bảo đảm (reliable  
transport) giữa 2 tiến trình gửi và  
nhận  
UDP service:  
ꢁ Vận chuyển thường (ko bảo  
đảm) giữa các tiến trình gửi  
và nhận.  
Ko bảo đảm: quá trình thiết  
lập thông số, vận chuyển  
đảm bảo, flow control,  
congestion control, kịp thời,  
bảo đảm băng thông tối  
thiểu hay, an ninh  
ꢁ Đúng nội dung, ko mất gói tin, ko trùng  
gói tin  
ꢁ Đúng thứ tự  
ꢁ flow control: bên gửi ko gửi quá  
nhanh, làm tràn dữ liệu bên nhận  
ꢁ congestion control: điều tiết tốc độ  
gửi dữ liệu khi mạng quá tải (ko  
hẳn tốt!).  
Q: why bother? Why is there  
a UDP?  
ꢁ Ko bảo đảm: tính kịp thời, băng  
2: Application Layer  
19  
thông tối thiểu, an ninh  
Internet apps: application, transport protocols  
Giao thꢁc ꢉ tꢊng  
ꢁng dꢂng  
Giao thꢁc  
vꢋn chuyꢌn  
ꢈng dꢂng  
SMTP [RFC 2821]  
Telnet [RFC 854]  
FTP [RFC 959]  
e-mail  
remote terminal access  
W
TCP  
TCP  
CP  
TCP  
file transfer  
HTTP (eg Youtube),  
RTP [RFC 1889]  
SIP, RTP, proprietary  
(e.g., Skype)  
streaming multimedia  
TCP or UDP  
Internet telephony  
typically UDP  
2: Application Layer  
20  
Tải về để xem bản đầy đủ
pdf 120 trang yennguyen 58920 Free
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Computer Networking - Chapter 2: Application Laye - 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:

  • pdfbai_giang_computer_networking_chapter_2_application_laye_le.pdf