client-server systems
Download
Report
Transcript client-server systems
Unit 5. Network Systems
1
Yun Zhang
Introduction to Computer Systems
Network Systems
•
•
•
•
•
•
Reading Sequence:
5.1 Internet Basics
5.2 Local and Wide Area Networks
5.3 Communication Strategies
5.4 Data Transfer Technologies
5.5 Internet Architecture
2
Yun Zhang
Introduction to Computer Systems
Network & Internet
• A communications network is the
combination of hardware, software, and
connecting links that transport data.
• The Internet refers to a global, public
network that uses TCP/IP protocol and
includes servers that handle e-mail, Web
sites, file downloads, and so on.
3
Yun Zhang
Introduction to Computer Systems
Network Topology
点对点连接
(这是最简单的网络)
总线网
集线器
星形网
Yun Zhang
环形网
Introduction to Computer Systems
4
5.1 Internet Basics
• In a short period of time, the Internet has
become essential to how people and
businesses communicate with each other
around the world. Using a browser and
email are important skills today. This
section provides some general
background on the Internet and helps you
become more familiar with the features of
your browser and email programs.
5
Yun Zhang
Introduction to Computer Systems
The World Wide Web
• Introduce the World Wide Web and its
workings.
– Using the Web
– What's in the Web?
– Introduction to HTML Forms and Servlets
6
Yun Zhang
Introduction to Computer Systems
Using the Web
•
•
•
•
•
•
Surfing the Web
Your Web Pages
Clients, Servers, and URLs
Searching the Web
Commerce on the Web
Some Ethical Considerations
7
Yun Zhang
Introduction to Computer Systems
Surfing the Web
•
•
•
•
Internet
World Wide Web
Surfing
Internet Service Provider ( ISP )
8
Yun Zhang
Introduction to Computer Systems
Internet
• Internet is a computer network that connects
millions of computers across a number of
countries.
• There is no central authority that controls the
Internet; different organizations own different
pieces of it.
• The Internet was originally conceived of by the
Advanced Research Project Agency (ARPA) of
the U.S. government in the 1960s.
9
Yun Zhang
Introduction to Computer Systems
Word Wide Web
• the Web, WWW or W3
• Portion of the computers on the Internet
that can communicate with each other
using a computer-network protocol called
HTTP (Hypertext Transfer Protocol ).
• All browsers use HTTP to request and
receive Web pages from other computers.
10
Yun Zhang
Introduction to Computer Systems
Surfing
• Browse on the Web
• page, place, site, web site
– Locations on the Web that you can visit
and view through a browser
• homepage
• No one can certify that information
presented on the Web is accurate,
correct, and up-to-date.
11
Yun Zhang
Introduction to Computer Systems
Internet Service Provider ( ISP )
• An ISP is any one of a number of
companies that enable people not only
to connect to the Internet and surf the
Web but also to publish Web pages.
• All Web sites must have unique names
or addresses—one per machine
12
Yun Zhang
Introduction to Computer Systems
Browse Sample
浏览武大网站:http://www.whu.edu.cn
武汉大学的网页
13
Yun Zhang
Introduction to Computer Systems
14
Yun Zhang
Introduction to Computer Systems
Clients, Servers
• Clients, Servers
– A client application requests information from a
server application or asks the server to perform
some task.
– Client asks for service.
– Server provides the service.
请求服务
The browser
is considered
a client.
Yun Zhang
提供服
务
The site that
supplies the
information
is considered
a server.
15
Introduction to Computer Systems
Clients, Servers
• Server applications are typically run on
powerful computers, since they need to be
able to service concurrent requests from a
number of clients.
• Client applications are typically run on less
powerful computers, such as PCs or
workstations.
16
Yun Zhang
Introduction to Computer Systems
http://www.whu.edu.cn/index.php
17
Yun Zhang
Introduction to Computer Systems
URLs
• Uniform Resource Locator naming scheme
– Provides user with a way to access Web
resources using a uniform means for
addressing resources.
[protocol]://[name of machine][name of resource]
18
Yun Zhang
Introduction to Computer Systems
URLs (Cont)
• [protocol]://[name of machine][name of resource]
name of the resource addressed by the URL
– ex: http :// www.icarnegie.com/courses.html
Hypertext Transfer Protocol
—— a communication protocl
–
–
name of the machine
hosting the resource
ftp :// www.icarnegie.com/index.htm
http://202.114.35.66
19
Yun Zhang
Introduction to Computer Systems
Basic Work Model
• Client sends a request for a resource
– A protocol (How do I get the resource?).
– The server (What server has this resource?).
– The resource itself (What resource
specifically?).
• Server
– Locates the resource requested.
– Transmits a copy of the resource back to the
client using the specified protocol.
20
Yun Zhang
Introduction to Computer Systems
Browse Sample
浏览武大网站:http://www.whu.edu.cn
武汉大学的网页
Dynamic Web Content
—— extend the basic client-server model
21
Yun Zhang
Introduction to Computer Systems
Searching the Web
• Browsing and searching
• Search engine is a program that
allows one to search for keywords in
files at one or more Internet sites.
– Excite: www.excite.com
– AltaVista: www.altavista.com
– Lycos: www.lycos.com
– Google: www.google.com
22
Yun Zhang
Introduction to Computer Systems
How to search
• Use a search site
• Type key words of your search into the
search engine
• Search….
• Use the help information offered by each
search engine.
23
Yun Zhang
Introduction to Computer Systems
A search Sample
http://www.google.com/intl/zh-CN/
24
Yun Zhang
Introduction to Computer Systems
25
Yun Zhang
Introduction to Computer Systems
Searching the Web (Cont)
• Tow types of Search Sites
– Sites that feature a search engine
• Sites of this type maintain indexes or
databases of the addresses of virtually all
of the pages and documents on the Web.
These indexes and databases are
updated regularly and automatically by
programs known as "spiders, “crawler”
26
Yun Zhang
Introduction to Computer Systems
Searching the Web (Cont)
• Tow types of Search Sites
– Sites that feature a Web directory
• it organizes information available on the Web
into different categories and subcategories.
27
Yun Zhang
Introduction to Computer Systems
Search Engine
• Full Text Search Engine
– Google, Fast/AllTheWeb, AltaVista, Inktomi,
WiseNut, Teoma, Baidu, Lycos…
• Search index/Directory
– Yahoo, LookSmart, 搜狐, 新浪, 网易…
• Meta Search Engine
– InforSpace, Dogpile, Vivisimo, 搜星…
28
Yun Zhang
Introduction to Computer Systems
Commerce on the Web
• Web-based Internet commerce
– Internet Service Providers (ISPs)
• sell you access to the Internet
– Advertising
– Commercial Transactions
29
Yun Zhang
Introduction to Computer Systems
30
Yun Zhang
Introduction to Computer Systems
Some Ethical Considerations
• Can you go to your favorite sports team's
Web page, make a copy of the .jpeg or .gif
file that is their logo and put that logo on
your Web page?
• Can you put a link on your page to the
home page of your favorite sports team?
31
Yun Zhang
Introduction to Computer Systems
Internet Languages
•
•
•
•
HTML
XML
JavaScript
Java
32
Yun Zhang
Introduction to Computer Systems
HTML
• HTML stands for Hyper Text Markup Language. An
HTML file is a text file containing a set of predefined tags
that are used to specify how data should be displayed in
a browser or another application program. For example,
inserting the built-in tag "<i>" and "</i>" around a phrase
would italicized the phrase displayed. Because HTML is
composed of text, you can create an HTML file using a
text editor. To enable the Web browser to interpret how
you want the page to be displayed, you must save the
file with an "htm" or "html" file extension. Note that "<"
and ">" indicates the beginning and end of a tag,
respectively.
33
Yun Zhang
Introduction to Computer Systems
HTML example
• 1. Open a text editor application such as Notepad.exe.
• 2. Copy the following text and paste it into the text editor
program:
• <html>
<head>
<title>Page title</title>
</head>
<body>
This is an example of a Web page. <b>A tag is used to
make this text appear bold.</b>
</body>
</html>
• 3. Save the file on Desktop as "sample.html".
• 4. Open a Web browser application.
34
Yun Zhang
Introduction to Computer Systems
XML
• XML (eXtensible Markup Language).
• Differences between HTML and XML:
– HTML tags are primarily concerned with how
text should be displayed, XML tags can be
used to describe what a piece of text means.
– There are no predefined tags in XML. Users
have the freedom to define their own tags.
– For example, <phone>4125551212</phone>
35
Yun Zhang
Introduction to Computer Systems
JavaScript
• JavaScript is a "scripting language," which
means the instructions the programmer
writes are not compiled in advance.
Instead, they are interpreted by an
application when the script is run by the
computer.
36
Yun Zhang
Introduction to Computer Systems
JavaScript example
•
<html>
<head>
<title>JavaScript Demonstration</title>
<script type="text/javascript" language="JavaScript1.2">
function display() {
document.body.bgColor = "black";
var ln1 = "Hello World!";
var ln2 = "This is the " + document.title + " page.";
var str = ln1.fontcolor("lime") + "<br />" + ln2.fontcolor("red");
document.writeln(str);
}
</script>
</head>
<body>
<script type="text/javascript" language="JavaScript1.2">
display();
</script>
</body>
</html>
37
Yun Zhang
Introduction to Computer Systems
Java
• Java is a high-level programming
language that was developed by Sun
Microsystems and has become a popular
programming tool for web-based projects.
Small Java applications are called Java
applets.
38
Yun Zhang
Introduction to Computer Systems
Java example
• import java.applet.Applet;
import java.awt.Graphics;
public class Demonstration extends Applet {
public void paint(Graphics g) {
g.drawRoundRect(5, 5, 100, 50, 10, 10);
g.drawString("Hello World!", 23, 35);
}
}
39
Yun Zhang
Introduction to Computer Systems
5.2 Local and Wide Area
Networks
• Reading Sequence:
• Textbook, Subsection "Internet Resources"
in Section 1B.
• Textbook, Section 5B.
• Textbook, Section 5D.
40
Yun Zhang
Introduction to Computer Systems
Network Classifications
• An internetwork, or “internet”, is a network
that is composed of many smaller
networks.
41
Yun Zhang
Introduction to Computer Systems
Network Classifications
• Intranet: “Intra”的意思是“内部的”,合起
来就是“内部网”,由于它主要是指企业
内部的计算机网络,所以也称“企业内部
网”。从原理上来说,Intranet其实就是一
个局域网,只是功能非常全面,在Intranet
内部可以象Internet上一样收发电子邮件,
进行WWW浏览。当然这些操作都只限于在
企业内部,并不能直接从Internet获取信息。
42
Yun Zhang
Introduction to Computer Systems
Network Classifications
• LAN (Local Area Network局域网):在一个相对有
限的地理范围内,由一组PC、服务器、打印机和
类似的设备连接组成的网络。
• WAN (Wide Area Network广域网):是一种跨地区
的数据通讯网络,通常包含一个国家或地区。广域
网通常由两个或多个局域网组成。计算机常常使
用电信运营商提供的设备作为信息传输平台,例如
通过公用网,如电话网,连接到广域网,也可以通过
专线或卫星连接。
43
Yun Zhang
Introduction to Computer Systems
Network Classifications
• MAN (Metropolitan Area Network,城域网)
是在一个城市范围内所建立的计算机通信
网,范围在80km之内。80年代末,在LAN的
发展基础上提出的。
• Wireless network:无线网络,就是利用无线
电波作为信息传输的媒介构成的网络,与
有线网络的用途十分类似,最大的不同在于
传输媒介的不同。
44
Yun Zhang
Introduction to Computer Systems
5.3 Communication Strategies
• Read:
• 5.3.1 Client-Server Framework. Learning
Goal: Understanding thin and thick clients.
• 5.3.2 Peer-to-Peer Connectivity. Learning
Goal: Understanding how each machine is
both a client and a server, and what
impact this has on computing.
45
Yun Zhang
Introduction to Computer Systems
client-server systems
• Many network applications are organized as clientserver systems. The client runs on the user's
computer and interacts with both the user and the
server.
• The server can accept requests from any number of
clients. It performs some service for them and
returns the results.
46
Yun Zhang
Introduction to Computer Systems
Clients, Servers
• Clients, Servers
– A client application requests information
from a server application or asks the server
to perform some task.
– Client asks for service.
– Server provides the service.
请求服务
The browser
is considered
a client.
Yun Zhang
提供服
务
The site that
supplies the
information
is considered
a server.
47
Introduction to Computer Systems
Example
• World Wide Web: The client is the Web browser
program. For a machine to host a Web site, it
must run a Web server program that clients can
talk to.
• Email: Microsoft Outlook, is the client. The
server is a program that accepts and stores
incoming mail for users, and delivers the mail to
them when their client requests it. Servers can
also forward mail to other servers if necessary.
48
Yun Zhang
Introduction to Computer Systems
Clients, Servers
• Server applications are typically run on
powerful computers, since they need to be
able to service concurrent requests from a
number of clients.
• Client applications are typically run on less
powerful computers, such as PCs or
workstations.
49
Yun Zhang
Introduction to Computer Systems
client-server systems
• thick clients & thin clients.
• based on how much work is done on the client
side: a thin client does relatively little work. A
thick client carries out a substantial portion of the
overall work of the system.
• Web surfing use, the browser acts as a thin client,
while the work of searching a database and
organizing the results is carried out by servers.
• a system might download a Java applet to the
browser, and that applet might act as a thick
client.
50
Yun Zhang
Introduction to Computer Systems
Peer-to-Peer Connectivity
• Peer-to-peer (P2P). Instead of having a
central server that all clients communicate
with, every member of a peer-to-peer
network can communicate with any other
member.
• E.g.:a multi-player network game; Napster,
emule
51
Yun Zhang
Introduction to Computer Systems
Client/server & Peer-to-peer
52
Yun Zhang
Introduction to Computer Systems
5.4 Data Transfer Technologies
•
•
•
•
•
•
Reading Sequence:
Textbook, Section 5A.
Textbook, Section 5C.
Domain Name Service & URL
OSI Layers
TCP/IP Protocols
53
Yun Zhang
Introduction to Computer Systems
分组从 A 传送到 B 的过程
查找路由表
查找路由表
目的地
目的地
下一跳路由器
下一跳路由器
查找路由表
路由器
A
目的地
下一跳路由器
网络
网络
网络
路由器
路由器
网络
网络
路由器
路由器
路由器
网络
网络
B
54
Yun Zhang
Introduction to Computer Systems
每个分组的首部都有 IP 地址信息
根据目的 IP 地址
查找路由表
查出下一跳路由器的地址
目的 IP 地址
源 IP 地址
根据目的 IP 地址
查找路由表
网络
路由器
查出下一跳路由器的地址
网络
路由器
网络
路由器
网络
路由器
55
Yun Zhang
Introduction to Computer Systems
What is a URL?
• Every Web page has a unique address
called a URL (Uniform resource locator统
一资源定位符 ).
• Most URLs begin with http://
56
Yun Zhang
Introduction to Computer Systems
开放系统互连基本参考模型
(OSI/RM)
• 国际标准化组织(International Standards Organization-ISO)经过反复地研究,在已有的网络体系结构(如DNA、
SNA等)的基础上,制定了开放系统互连参考模型(Open
Systems Interconnection Reference Model—OSI/RM)。
供设计、实现和
应用各种计算机
网络参考。
• 一个系统是开放
的,是指它可与世
界上任何地方的遵
守相同标准的其他
任何系统通信。
57
Yun Zhang
Introduction to Computer Systems
计算机 2
计算机 1
AP1
首部
5
TCP报文段
UDP报文段
4
3
IP数据报
IP分组
帧
2
比特
1
应用程序数据
H2
AP2
5
数 据 部 分
H5
H4
数 据 部 分
数
H3
据
部
分
数
据
部
分
10100110100101 …
比
特
流
4
尾部
T2
… 11 010111010
3
2
1
物 理 传 输 媒 体
58
Yun Zhang
Introduction to Computer Systems
protocol协议
• 在计算机网络中,协议(protocol,网络协议)是
通信双方必须严格遵守的规则。是为进行网络
中的数据交换而建立的规则、标准或约定。这
些规则明确规定了所交换的数据的格式及有关
同步问题。
• 协议精确地规定在网络通信中使用的各种控制
信息的格式、意义以及各种事件出现的先后顺
序。
• 协议在计算机网络中起着非常重要的作用。
59
Yun Zhang
Introduction to Computer Systems
划分层次的重要性
• 协议的三要素:
(1)语法数据与控制信息的结构或格式
(2)语义即需要发出何种控制信息,完
成何种动作以及做出何种应答
(3)同步即事件实现顺序的详细说明。
60
Yun Zhang
Introduction to Computer Systems
IP/TCP
• 因特网使用的协议很多,但其中最为重要
的协议就是 IP 和 TCP。
• 分组在因特网中传送要使用 IP 协议。计算
机数据传输的可靠性由 TCP 协议来保证。
• 通常用 TCP/IP 这样的记法表示以 TCP 和
IP 为核心的协议族。
61
Yun Zhang
Introduction to Computer Systems
最重要的两个协议:IP 和 TCP
应用
程序
TCP 协议保证了
应用程序之间的可靠通信
应用
程序
因特网
IP 协议控制分组在因特网的传输
但因特网不保证可靠交付
62
Yun Zhang
Introduction to Computer Systems
IP Protocol
• 因特网的 IP 协议最重要,它为分组在互连网
中的发送、传输和接收制定了详尽的规则。
• IP 是 Internet Protocol 的缩写,中文标准译
名是“网际协议”。
• 使用 IP 协议的互连网络常称为:
– IP 网络或IP 网。
• 在 IP 网络传送的分组常称为:
– IP 分组或IP 数据报 (IP datagram)。
63
Yun Zhang
Introduction to Computer Systems
TCP Protocol
• TCP 是 Transmission Control Protocol 的
缩写,中文译名是传输控制协议。
• TCP 协议驻留在用户计算机中,它的作用
是保证应用程序之间端到端的可靠通信。
64
Yun Zhang
Introduction to Computer Systems
TCP Protocol
• TCP 给要传送的每一个字节的数据都进行
编号。
– 接收端在收到数据后必须向发送端发送确认信
息。
– 若发送端在规定的时间内没有收到对方的确认,
就重传这部分数据。
• 当网络中的通信量过大时,TCP 就告诉发
送端要放慢发送数据。这叫做流量控制。
65
Yun Zhang
Introduction to Computer Systems
HTTP (HyperText Transfer Protocol)
• HTTP (hypertext Transfer Protocol超文本传
送协议 ) is the communications standard
that’s instrumental in ferrying Web
documents to all corners of the Internet.
• 万维网客户程序与服务器程序之间的交互
遵守超文本传送协议 HTTP
66
Yun Zhang
Introduction to Computer Systems
Email
• 电子邮件是因特网最受欢迎的应用
• 电子邮件大大方便了人们的生活、工作和
学习。
• 电子邮件也改变了人们生活、工作和学习
的方式。
67
Yun Zhang
Introduction to Computer Systems
发送邮件使用的协议——简单邮件传送协议
SMTP (Simple Mail Transfer Protocol)
接收邮件使用的协议——邮局协议版本3
POP3 (Post Office Protocol version 3)
sina.com
mail.cctv.com
发送端 ISP
接收端 ISP
使用 POP3 协议接收方
发送方使用 SMTP 协议
使用 SMTP 协议
因特网
邮件服务器
邮件缓存
发信人地址:[email protected]
用户名
读作 “at”
(用户邮箱)
邮件服务器的域名
Yun Zhang
用户邮箱
邮件服务器
收信人地址:[email protected]
邮件的传送仍然要使用
IP 和 TCP 协议 68
Introduction to Computer Systems
MIME Types
• It is possible to attach images and other types of
documents to an email message. This raises a
problem: how is the mail client supposed to
know what to do with these documents?
• The solution is to give each attachment a label
explaining what kind of document it is. The
labels are called MIME types (the acronym for
Multipurpose Internet Mail Extension多用途互
联网邮件扩展).
69
Yun Zhang
Introduction to Computer Systems
电子邮件的优点与缺点
• 优点:
– 快捷
– 价廉
– 不打断对方工作或休息
• 缺点
– 有时邮件很慢或甚至丢失
– 对垃圾邮件尚无有效对策
70
Yun Zhang
Introduction to Computer Systems
Exercise 5
• Question1. XML and HTML
• One necessary component to facilitate electronic
commerce is the capability to exchange data over
varying systems. In this section, you will strengthen your
knowledge of XML as a portable language that enables
data to be handled by any computer system.
• a. What does the term “XML” stand for? What is the
function of XML tags, and how does the function of XML
tags differ from the function of HTML tags?
• b. Contrast the flexibility of using XML tags and HTML
tags.
71
Yun Zhang
Introduction to Computer Systems
Exercise 5
• c. What is one reason why storing data in
XML may be preferred to enable multiple
systems to exchange data?
• Download and save Movies100EX.xml
and display.html on your Desktop.
• Open Movies100EX.xml using
Notepad.exe to see the content of the XML
file.
72
Yun Zhang
Introduction to Computer Systems
Exercise 5
•
•
•
f. For the movie titled, “Top Gun”, list the following:
Year:
Score:
Open display.html using Notepad.exe to see the content of the HTML file.
Note that the references used to embed the xml file are highlighted in bold
font below:
<html>
<body>
<xml id="movies" src="Movies100EX.xml"></xml>
This is a nice use of non-standard HTML. Do we really want to use IE only
items. Also, since it is non-standard will the students have gained the
knowledge necessary to answer this question?
<table border="1" datasrc="#movies">
<tr>
<td><span datafld="Title"></span></td>
<td><span datafld="Year"></span></td>
<td><span datafld="Score"></span></td>
</tr>
</table>
</body>
</html>
73
Yun Zhang
Introduction to Computer Systems
Exercise 5
• Drag and drop display.html into an Internet Explorer
window to see how it is displayed.
• g. Generate another HTML file that displays additional
data fields from the XML file, listing Movie_id, Title, Year,
Score, and Votes. Save the HTML file as, “myXML.html”.
Copy and paste your HTML code.
• h. Use Internet Explorer to display myXML.html. Copy
the screen shot of this file showing 20 movie entries and
paste the screen shot into your assignment submission.
• Delete Movies100EX.xml, display.html, and myXML.html
from Desktop.
74
Yun Zhang
Introduction to Computer Systems
Exercise 5
• Question 2 Network Failure
• In addition to Tracert, other network tools
such as IPconfig and Ping can be used to
troubleshoot network issues.
• You can use ipconfig command to see
whether your computer is connected to the
Internet.
• Pull up the command console. Type
“ipconfig /all”.
75
Yun Zhang
Introduction to Computer Systems
Exercise 5
• a. Are you connected to the Internet? Paste the
screenshot showing the result of the command, ipconfig.
• b. What is your IP address?
• c. What are the IP addresses of your DNS servers?
• You can use Ping to test the response of the destination
server.
• d. First, launch the Windows Command Console. Type,
“ping www.yahoo.com”. Copy and paste the screenshot
of the Ping command.
• e. Did you get a response from the target server?
• f. List two possible explanation(s) for the result of the
Ping command below:
•
76
Yun Zhang
Introduction to Computer Systems
Exercise 5
• Figure 2 Ping Result
77
Yun Zhang
Introduction to Computer Systems