Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu

Web programming with ASP.

Visual Basic programming.

Object oriented programming.

Event driven programming.

Component driven programming.

TCP Socket programming.

Simple web server.

 

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 1

Trang 1

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 2

Trang 2

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 3

Trang 3

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 4

Trang 4

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 5

Trang 5

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 6

Trang 6

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 7

Trang 7

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 8

Trang 8

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 9

Trang 9

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu trang 10

Trang 10

Tải về để xem bản đầy đủ

ppt 46 trang Danh Thịnh 10/01/2024 2320
Bạn đang xem 10 trang mẫu của tài liệu "Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu", để tải tài liệu gốc về máy hãy click vào nút Download ở trên

Tóm tắt nội dung tài liệu: Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu

Bài giảng Mạng máy tính - Chương 2: Giao thức tầng ứng dụng (application layer) (Tiếp theo) - Trần Quang Diệu
Chương 2 (tiếp).Giao thức tầng ứng dụng (application layer) 
Quang Dieu Tran, PhD 
Faculty of Information Technology 
University of Communication and Transport ( Branch in Ho Chi Minh City) 
Email : dieutq@gmail.com 
Website: sites.google.com/sites/tranlectures 
Chapter 2. The Application Layer 
2 
Discussion 
Web programming with ASP. 
Visual Basic programming. 
Object oriented programming. 
Event driven programming. 
Component driven programming. 
TCP Socket programming. 
Simple web server. 
Chapter 2. The Application Layer 
3 
Winsock 
Chapter 2. The Application Layer 
4 
HTTP example 
1a . http client thiết lập liên kết TCP với http server (process) tại địa chỉ www.uct2.edu.vn, cổng 80 (ngầm định với http server). 
2. http client gửi http request message (bao gồm cả URL) tới TCP connection socket 
1b. http server chấp nhận kết nối rồi thông báo với client. 
3. http server nhận request message, tạo ra http response message có chứa các đối tượng được yêu cầu rồi gửi vào socket. 
time 
Giả sử người dùng truy cập URL: www.uct2.edu.vn/index.htm 
(trang web có text và 10 hình ảnh jpeg) 
0. http server tại máy phục vụ www.uct2.edu.vn chờ yêu cầu kết nối TCP tại cổng 80. 
Chapter 2. The Application Layer 
5 
5 . http client nhận response message có chứa html file, hiển thị html. Sau đó, phân tích html file, tìm URL của 10 hình ảnh jpeg trong tài liệu. 
6. Bước 1-5 được lặp lại với từng hình ảnh. 
4. http server ngắt liên kết. 
time 
Chapter 2. The Application Layer 
6 
Ch2. The Application Layer 
2.1. Một số khái niệm và nguyên tắc. 
2.2. Web & Hyper Text Transfer Protocol. 
2.3. Web design and HTTP, Web programming. 
2.4. File Transfer Protocol. 
2.5. Electronic Mail Protocols. 
2.6. Domain Name System. 
Chapter 2. The Application Layer 
7 
2.4. FTP - File Transfer Protocol 
Truyền/tải tệp (to/from remote host). 
Client/server model 
Client: đưa ra yêu cầu truyền tải. 
Server = remote host. 
FTP: RFC 959 
file transfer 
FTP 
server 
FTP 
user 
interface 
FTP 
client 
local file 
system 
remote file 
system 
user 
at host 
Chapter 2. The Application Layer 
8 
FTP: control & data connections 
FTP sử dụng TCP. 
FTP sử dụng đồng thời 2 liên kết TCP tại 2 cổng: 
TCP control connection, port 21: trao đổi các thông điệp điều khiển (commands, responses). 
TCP data connection, port 20: truyền tải tệp. 
FTP lưu giữ trạng thái client trong phiên làm việc (state vs. HTTP is stateless). 
FTP 
client 
FTP 
server 
TCP control connection 
port 21 
TCP data connection 
port 20 
Chapter 2. The Application Layer 
9 
FTP: Quá trình trao đổi/truyền tải 
FTP server nghe tại cổng 21. 
FTP client yêu cầu kết nối với FTP server qua TCP tại cổng 21. Gửi user & password để đăng nhập. 
FTP server chấp nhận, liên kết điều khiển (control connection) được thiết lập. Quá trình trao đổi có thể bắt đầu. 
Khi server nhận được lệnh truyền tệp, nó mở liên kết dữ liệu (data connection) tới client, tệp được truyền qua liên kết này. 
Sau khi truyền xong một tệp, server ngắt liên kết dữ liệu (mỗi liên kết chỉ sử dụng để truyền một tệp). 
client 
server 
TCP control connection 
port 21 
TCP data connection 
port 20 
Chapter 2. The Application Layer 
10 
FTP commands, responses 
Sample commands: 
sent as ASCII text over control channel 
USER username 
PASS password 
LIST return list of file in current directory 
RETR filename retrieves (gets) file 
STOR filename stores (puts) file onto remote host 
Sample return codes 
status code and phrase (as in HTTP) 
331 Username OK, password required 
125 data connection already open; transfer starting 
425 Can’t open data connection 
452 Error writing file 
Lệnh (commands), phúc đáp (responses) được truyền dạng ASCII 
Chapter 2. The Application Layer 
11 
FTP clients & servers 
Command-based client: 
Windows FTP command. 
Linux FTP command. 
GUI clients 
Windows Commander. 
CuteFTP, WS_FTP 
Microsoft FTP Service 
file transfer 
FTP 
server 
FTP 
user 
interface 
FTP 
client 
local file 
system 
remote file 
system 
user 
at host 
Chapter 2. The Application Layer 
12 
Ch2. The Application Layer 
2.1. Một số khái niệm và nguyên tắc. 
2.2. Web & Hyper Text Transfer Protocol. 
2.3. Web design and HTTP, Web programming. 
2.4. File Transfer Protocol. 
2.5. Electronic Mail Protocols. 
2.6. Domain Name System. 
Chapter 2. The Application Layer 
13 
2.5. Electronic Mail 
Ba thành phần chính: 
User agents (mail clients) 
Soạn, đọc thư (messages). 
Vd: Outlook, Eudora, Netscape Messenger... 
Mail servers 
Lưu trữ, xử lý thư. 
Vd: Exchange, MDeamon 
Protocols 
Simple Mail Transfer Protocol (SMTP). 
Post Office Protocol (POP). 
Internet Mail Access Protocol (IMAP). 
HTTP. 
user mailbox 
outgoing 
message queue 
mail 
server 
user 
agent 
user 
agent 
user 
agent 
mail 
server 
user 
agent 
user 
agent 
mail 
server 
user 
agent 
SMTP 
SMTP 
SMTP 
Chapter 2. The Application Layer 
14 
Alice Bob 
1) Alice sử dụng UA soạn thư, đ/c gửi tới “to”: bob@yahoo.com. 
2) Alice’s UA gửi thư đến mail server của Alice, bức thư được xếp vào hàng đợi (message queue). 
3) Mail server của Alice mở liên kết TCP tới mail server của Bob. 
4) Mail server của Alice gửi thư qua liên kết TCP. 
5) Mail server của Bob cất thư nhận được vào hòm thư của Bob. 
6) Bob dùng UA để lấy thư từ server về rồi đọc thư. 
user 
agent 
mail 
server 
mail 
server 
user 
agent 
1 
2 
3 
4 
5 
6 
uct2.edu.vn 
yahoo.com 
Outlook 
Yahoo! Mail 
Chapter 2. The Application Layer 
15 
SMTP (Simple Mail Transfer Protocol) 
Sử dụng liên kết TCP (port 25) để gửi mails: 
Từ sender’s mail client tới sender’s mail server. 
Từ sender’s mail server tới receiver’s mail server. 
Ba pha (three ways handshake): 
Bắt tay (handshaking/greeting). 
Trao đổi messages. 
Kết thúc. 
Command/response: 
commands: ASCII. 
responses: status code & phrase.

File đính kèm:

  • pptbai_giang_mang_may_tinh_chuong_2_giao_thuc_tang_ung_dung_app.ppt