第二章授课计划
授课章节
节
第一网络应用层原理
节
第二Web 和HTTP
节
第三文件传输:FTP
节
第四电子邮件
节
第五互联网目录服务:DNS 节
第六P2P文件共享
教学目的与要求本章主要介绍应用层的概念、原理以及实现。要求学生掌握应用层协议的原理以及应用程序的实现。
教学重点掌握应用层的协议原理以及实现。
教学难点通过编程实现应用程序。
与前后章节
的关系
应用层的协议需要通过底层传输层协议实现。
授课类型理论教学+实训+讨论等
教学方法
案例型
计划课时6学时
备注
课时计划
第2章第1学时
本次课计划课时:1学时
教学要点:
1.网络应用层的概念、实现
2.传输层服务模型
3.HTTP协议
与前续课和后续课的关系:
第一章讲述了TCP/IP协议的分层结构,应用层是协议栈的最高层,其中Web 应用是最常使用的应用。这节课讲述应用层的基本原理,下节课对HTTP协议进行详细的分析。
主要教学环节:
1.网络应用层的原理
2.网络应用层的体系结构
3.进程之间的通信
4.应用层协议
5.应用层需要的服务
6.互联网传输层提供的服务
教学过程
1.网络应用层的原理
时间分配:5分钟
教学方法:讲授
教学过程
Some network apps
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 No software written for devices in network core
Network core devices do not function at app layer
This design allows for rapid app development
重点:注意强调应用程序只运行在终端设备
2.网络应用层的体系结构
时间分配:10分钟
教学方法:讲授
教学过程
Client-server archicture server:
n host
always-on host
permanent IP address
server farms for scaling
clients:
communicate with server
may be intermittently connected
may have dynamic IP addresses
do not communicate directly with each other Pure P2P architecture Pure P2P architecture
no always on server
arbitrary end systems directly communicate
peers are intermittently connected and change IP addresses example: Gnutella
Highly scalable,But difficult to manage
Hybrid of client-server and P2P Napster
File transfer P2P
File search centralized:
?Peers register content at central server
?Peers query same central server to locate content
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
重点:各种结构的特点
3.进程之间的通信
时间分配:20分钟 教学方法:提问+讲授 教学过程
提问:什么是进程?
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
注意:P2P 应用程序同时具有客户端进程和服务器进程
Sockets
process sends/receives messages to/from its socket
socket analogous to door
sending process shoves message out door
sending process relies on transport infrastructure on other side of door which brings message to socket at receiving process
host or host or server
server
by OS
API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later)Addressing processes
For a process to receive messages, it must have an identifier
A host has a unique32-bit IP address
Q: does the IP address of the host on which the process runs suffice for identifying the process?
Answer: No, many processes can be running on same host
Identifier includes both the IP address and port numbers associated with the process on the host.
Example port numbers:
HTTP server: 80
Mail server: 25
重点:1.进程间通信和主机间通信的区别;
2.sockets编程。
4.应用层协议
时间分配:5分钟
教学方法:讲授
教学过程
App-layer protocol defines
Types of messages exchanged, eg, request & response messages
Syntax of message types: what fields in messages & how fields are delineated Semantics of the fields, ie, meaning of information in fields
Rules for when and how processes send & respond to messages
Public-domain protocols:
defined in RFCs
allows for interoperability
eg, HTTP, SMTP
Proprietary protocols:
eg, KaZaA
重点:应用层协议的定义
5.应用层需要的服务
时间分配:5分钟
教学方法:讲授
教学过程
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”
Bandwidth some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective” other apps (“elastic apps”) make use of whatever bandwidth they get Transport service requirements of common apps
file transfer stored audio/video no loss
loss-tolerant
elastic no
yes, few secs
Application
e-mail Web documents real-time audio/video interactive games
instant messaging Data loss
no loss
no loss
loss-tolerant
loss-tolerant
no loss
Bandwidth
elastic
elastic
audio: 5kbps-1Mbps
video:10kbps-5Mbps
same as above
few kbps up
elastic
Time Sensitive
no
no
yes, 100’s msec
yes, 100’s msec
yes and no
重点:不同的应用程序对性能的要求有所不同
6. 互联网传输层提供的服务 时间分配:5分钟 教学方法:讲授 教学过程
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 won’t 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
问题:why bother? Why is there a UDP?
Internet apps: application, transport protocols
重点:不同应用所需要的传输层服务
Application SMTP [RFC 2821]Underlying
TCP Application
remote terminal access
Web file transfer
Internet telephony
layer protocol Telnet [RFC 854]HTTP [RFC 2616]FTP [RFC 959](e.g. RealNetworks)proprietary (e.g., Dialpad)
transport protocol TCP TCP TCP
TCP or UDP
typically UDP
小结:
本次课程的主要内容:
1.网络应用层的原理
2.网络应用层的体系结构
3.进程之间的通信
4.应用层协议
5.应用层需要的服务
6.互联网传输层提供的服务下次课程的主要内容:
1.Web和HTTP
2.非持久和持久连接
3.HTTP格式
作业:
P.170
Review questions
234
...6.
第2章第2学时
本次课计划课时:1学时
教学要点:
1.HTTP概述
2.非持久和持久连接
与前续课和后续课的关系:
上节课讲述了应用层的基本原理,在此基础上,这节课对应用层的一种协议HTTP协议进行详细的分析。
下节课继续讲授另外的应用层协议:文件传输协议FTP和电子邮件所用到的协议。
主要教学环节:
1.Web和HTTP
2.HTTP概述
3.非持久和持久连接
4.HTTP消息格式
教学过程:
1.Web和HTTP
时间分配:5分钟
教学方法:讲授
教学内容:
First some jargon
Web page consists of objects
Object can be HTML file, JPEG image, Java applet, audio file,…
Web page consists of base HTML-file which includes several referenced objects
Each object is addressable by a URL
Example URL:
构成 . HTTP 概述 钟 rview https://www.doczj.com/doc/fc9058734.html,/someDept/pic.gif
host name
path name
重点:网页的
2时间分配:10分教学方法:讲授 教学内容:
HTTP ove
r protocol
quests, receives, “displays” Web objects HTTP: hypertext transfe Web’s application layer protocol
client/server model
client: browser that re
server: Web server sends objects in response to requests HTTP 1.0: RFC 1945
HTTP 1.1: RFC 2068
Mac running Navigator
Uses TCP:
client initiates TCP connection (creates socket) to server, port 80
server accepts TCP connection from client
HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
TCP connection closed
HTTP is “stateless”
server maintains no information about past client requests
注意:Protocols that maintain “state” are complex! past history (state) must be maintained
if server/client crashes, their views of “state” may be inconsistent, must be reconciled
重点:HTTP请求和响应的过程
3.非持久和持久连接
时间分配:20分钟
教学方法:讲授
教学内容:
HTTP connections
Nonpersistent HTTP
At most one object is sent over a TCP connection.
HTTP/1.0 uses nonpersistent HTTP
Persistent HTTP
Multiple objects can be sent over single TCP connection between client and server. HTTP/1.1 uses persistent connections in default mode
Response time modeling
Definition of RRT: time to send a small packet to travel from client to server and back. Response time:
one RTT to initiate TCP connection
one RTT for HTTP request and first few bytes of HTTP response to return
file transmission time
total = 2RTT+transmit time Persistent HTTP
Nonpersistent HTTP issues:
requires 2 RTTs per object
OS must work and allocate host resources for each TCP connection
but browsers often open parallel TCP connections to fetch referenced objects
Persistent HTTP
server leaves connection open after sending response
subsequent HTTP messages between same client/server are sent over connection
Persistent without pipelining:
client issues new request only when previous response has been received
one RTT for each referenced object
Persistent with pipelining:
default in HTTP/1.1
client sends requests as soon as it encounters a referenced object as little as one RTT for all the referenced objects
重点:非持久和持久连接的工作过程
4.HTTP消息格式
时间分配:15分钟
教学方法:讲授
教学内容:
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
ASCII (human-readable format)
HTTP request message: general format Uploading form input
Post method:
Web page often includes form input
Input is uploaded to server in entity body
URL method:
Uses GET method
Input is uploaded in URL field of request line: Method types
HTTP/1.0
GET
POST
HEAD
asks server to leave requested object out of response
HTTP/1.1
GET, POST, HEAD
PUT
uploads file in entity body to path specified in URL field
DELETE
deletes file specified in the URL field
HTTP response message
HTTP response status codes
In first line in server->client response message.
A few sample codes:
200 OK
request succeeded, requested object later in this message
301 Moved Permanently
requested object moved, new location specified later in this message (Location:) 400 Bad Request
request message not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
Trying out HTTP (client side) for yourself
1.Web和HTTP
2.HTTP概述
3.非持久和持久连接
4.HTTP消息格式
第2章第3学时
本次课计划课时:1学时
教学要点:
1.cookies
2.web caching
3.文件传输协议:FTP
与前续课和后续课的关系:
上节课讲述了应用层的协议HTTP协议。这节课继续介绍另外的应用层协议:文件传输协议FTP。
下节课继续介绍电子邮件所用到的协议。
主要教学环节:
1.用户服务器交互:cookies
2.Web caching
3.有条件的GET
4.文件传输:FTP
教学过程:
1.用户服务器交互:cookies
时间分配:10分钟
教学方法:讲授
教学内容:
Many major Web sites use cookies
Four components:
1) cookie header line in the HTTP response message
2) cookie header line in HTTP request message
3) cookie file kept on user’s host and managed by user’s browser
4) back-end database at Web site
Example:
Susan access Internet always from same PC
She visits a specific e-commerce site for first time
When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID
Cookies: keeping “state” (cont.)
What cookies can bring:
authorization
shopping carts
recommendations
user session state (Web e-mail)
Cookies and privacy: cookies permit sites to learn a lot about you
you may supply name and e-mail to sites
search engines use redirection & cookies to learn yet more
advertising companies obtain info across sites
重点;cookies的交互过程。
2.Web caching
时间分配:15分钟
教学方法:提问+讲授
教学内容:
Web caches (proxy server)
问题:为什么使用web cache
satisfy client request without involving origin serveruser sets browser: Web accesses via cache
browser sends all HTTP requests to cache
object in cache: cache returns object
else cache requests object from origin server, then returns object to client
Cache acts as both client and server
Typically cache is installed by ISP (university, company, residential ISP)
Why Web caching?
Reduce response time for client request.
Reduce traffic on an institution’s access link.
Internet dense with caches enables “poor” content providers to effectively deliver content (but so does P2P file sharing)
Assumptions
average object size = 100,000 bits
avg. request rate from institution’s browsers to origin servers = 15/sec
delay from institutional router to any origin server and back to router = 2 sec Consequences
utilization on LAN = 15%
utilization on access link = 100%
total delay = Internet delay + access delay + LAN delay
= 2 sec + minutes + milliseconds
Possible solution
increase bandwidth of access link to, say, 10 Mbps
Consequences
utilization on LAN = 15%
utilization on access link = 15%
Total delay = Internet delay + access delay + LAN delay