




已阅读5页,还剩80页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. Chapter 2: Application layer 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications Chapter 2: Application Layer Our goals: conceptual, implementation aspects of network application protocols transport-layer service models client-server paradigm peer-to-peer paradigm 通过对常用应用层协议的 探讨和分析来学习网络协 议 HTTP FTP SMTP / POP3 / IMAP DNS programming network applications socket API Some network apps E-mail Web Instant messaging即时消息 Remote login远程登陆 P2P file sharing Multi-user network games Streaming stored video clips Internet telephone Real-time video conference Massive parallel computing Creating a network app Write programs that run on different end systems and communicate over a network. e.g., Web: Web server software communicates with browser software little software written for devices in network core network core devices do not run user application code application on end systems allows for rapid app development, propagation application transport network data link physical application transport network data link physical application transport network data link physical Chapter 2: Application layer 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server Application architectures Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P Client-server architecture server: always-on host permanent IP address clients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other Pure P2P architecture no always-on server Arbitrary(随意的) end systems directly communicate peers are intermittently( 间歇的) connected and change IP addresses Highly scalable but difficult to manage(高可扩展性但较难 管理) Hybrid of client-server and P2P Skype Internet telephony app Finding address of remote party: centralized server(s) Client-client connection is direct (not through server) Instant messaging Chatting between two users is P2P Presence detection/location centralized: User registers its IP address with central server when it comes online User contacts central server to find IP addresses of buddies Preparing Knowledge 进行通信的实际上不是软件,而是进程 网络应用程序的运行需要 一个应用程序用户代理 定义数据通信格式的标准 定义如何通信的协议 Processes communicating Process: program running within a host. within same host, two processes communicate using inter-process communication (defined by OS). processes in different hosts communicate by exchanging messages Client process: process that initiates communication Server process: process that waits to be contacted Note: applications with P2P architectures have client processes (2) ability to fix a few parameters (lots more on this later) 端口在进程之间的通信中所起的作用 应 用 层 运 输 层 网 络 层 TCP 报文段 UDP 用户数据报 应用进程 TCP 复用 IP 复用 UDP 复用 TCP 报文段 UDP 用户数据报 应用进程 端口端口 TCP 分用UDP 分用 IP 分用 IP 数据报IP 数据报 发送方 接收方 应用层协议分类 依赖于TCP协议的应用层协议 Telnet HTTP SMTP POP3 FTP 依赖于无连接的UDP协议的应用层协议 SNMP TFTP RPC 既依赖于TCP也依赖于UDP协议的应用层协议 DNS 非标准化协议 What transport service does an app need? Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Throughput r some apps (e.g., multimedia) require minimum amount of throughput to be “effective” r other apps (“elastic apps”) make use of whatever throughput they get Security r Encryption, data integrity, Transport service requirements of common apps Application file transfer e-mail Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no loss Bandwidth elastic elastic elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive no no no yes, 100s msec yes, few secs yes, 100s msec yes and no Internet transport protocols services TCP service: connection-oriented: setup required between client and server processes reliable transport between sending and receiving process flow control: sender wont overwhelm receiver congestion control: throttle sender when network overloaded does not provide: timing, minimum bandwidth guarantees UDP service: unreliable data transfer between sending and receiving process does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP? 传输层向上提供可靠的和不可靠的逻辑通信信道 ? 应 用 层 传 输 层 发 送 进 程 接 收 进 程 接 收 进 程 数据数据 全双工可靠信道 数据数据 使用 TCP 协议 使用 UDP 协议 不可靠信道 发 送 进 程 Internet apps: application, transport protocols Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP RFC 2821 Telnet RFC 854 HTTP RFC 2616 FTP RFC 959 proprietary (e.g. RealNetworks) proprietary (e.g., Vonage,Dialpad) Underlying transport protocol TCP TCP TCP TCP TCP or UDP typically UDP Addressing processes to receive messages, process must have identifier host device has unique32-bit IP address Q: does IP address of host on which process runs suffice满足 for identifying the process? Addressing processes to receive messages, process must have identifier host device has unique32- bit IP address Q: does IP address of host on which process runs suffice for identifying the process? Answer: NO, many processes can be running on same host identifier includes both IP address and port numbers associated with process on host. Example port numbers: HTTP server: 80 Mail server: 25 to send HTTP message to web server: IP address: 8 Port number: 80 多重协议的识别 网络环 境中一个进程的全网惟一的标识需要一个三元 组来表示:协议,本地地址,本地端口号。 App-layer protocol defines Types of messages exchanged, e.g., request, response Message syntax:语法 what fields in messages how fields are delineated Message semantics 语意 meaning of information in fields Rules for when and how processes send transfer starting 425 Cant open data connection 452 Error writing file FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 01 用户要用 FTP 和远地主机(网络信息中心 NIC 上的主机)建立连接。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 02 本地 FTP 发出的连接成功信息。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 03 从远地服务器返回的信息,220 表示“服务就绪”。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 04 本地 FTP 提示用户键入名字。用户键入的名字 表示“匿名”。用户只需键入 anonymous 即可。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 05 数字 331 表示“用户名正确”,需要口令。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 06 本地 FTP 提示用户键入口令。用户这时可键入 guest 作为匿名的口令,也可以键入自己的电子邮件 地址,即耶鲁大学数学系名为 xyz 的主机上的 abc。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 07 数字 230 表示用户已经注册完毕。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. “ftp”是 FTP 的提示信息。用户键入的是将 目录改变为包含 RFC 文件的目录。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 09 字符 CWD 是 FTP 的标准命令, 代表 Change Working Directory。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 10 用户要求将名为 rfc1261.txt 的文件复制到 本地主机上,并改名为 nicinfo。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 11 字符 PORT 是 FTP 的标准命令,表示要 建立数据连接。200 表示“命令正确”。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09 250 CWD command successful. 10 ftp get rfc1261.txt nicinfo 11 200 PORT command successful. 12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes). 13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s). 14 ftp quit 15 221 Goodbye. 12 数字 150 表示“文件状态正确, 即将建立数据连接”。 FTP 的屏幕信息举例 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready. 04 Name: anonymous 05 331 Guest login ok, send ident as password. 06 Password: 07 230 Guest login ok, access restrictions apply. 08 ftp cd rfc 09
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 铁合金炉料烧结工理念考核试卷及答案
- 线路工测试题(含答案)
- 卡轨车司机岗位操作规程考核试卷及答案
- 动物解剖生理试题(附答案)
- 电子竞技运营师质量管控考核试卷及答案
- 工业机器人系统运维员数字化技能考核试卷及答案
- 口腔修复学考试题及答案
- 种子繁育员协同作业考核试卷及答案
- 自轮运转设备检修工岗位操作技能考核试卷及答案
- 家禽屠宰加工工入职考核试卷及答案
- 2025年城市环境监测评估标准评估方案
- 2025年水面渔业养殖承包合同范本:水产养殖合作协议
- 2025年有害生物防治员初级理论知识考核试题及答案
- 新版2026统编版小学道德与法治三年级上册 第4课《 科技力量大》第1课时 科技改变生活和科技改变观念 教案设计(教案)
- 供应链金融操作指南
- 部编版语文六年级上册3《古诗词三首》(同步练习)(含答案)
- 2025-2026学年湘教版(2024)初中地理七年级上册教学计划及进度表
- 2025年重庆八中宏帆中学小升初自主招生数学试题(含答案详解)
- 学会交流与沟通课件
- 铁路监理培训考试试题及答案
- 2025全国企业员工全面质量管理知识竞赛题库附答案
评论
0/150
提交评论