Creating a network app write programs that: ▪ run on (different) end systems ▪ communicate over network ▪ e.g., web server software communicates with browser software application transport network data link physical application transport network data link physical application transport network data link physical no need to write software for network-core devices network-core devices do not run user applications applications on end systems allows for rapid app development, propagation 创建一个网络应用程序 在不同的终端运行 通过网络通信 不需要为网络内核设备编写软件 它不运行用户应用程序 终端系统上的应用程序可以快速开发传播
Application architectures possible structure of applications: • client-server • peer-to-peer (P2P) 应用程序结构
Client-server architecture server: • always-on host • permanent IP address • data centers for scaling client/server clients: • communicate with server • may be intermittently connected • may have dynamic IP addresses • do not communicate directly with each other服务器 1永远在线的主机 2永久ip地址 3用于扩展的数据中心 用户端 1与服务器通信 2可能间歇性连接 3可能动态ip地址 4彼此不直接通信
P2P architecture ▪ no always-on server ▪ arbitrary end systems directly communicate ▪ peers request service from other peers, provide service in return to other peers • self scalability – new peers bring new service capacity, as well as new service demands 新方向带来新服务能力和需求 ▪ peers are intermittently connected and change IP addresses • complex management P2P架构 1没有始终在线的服务器 2任意终端系统直接通信 3peers双方互相请求服务提供服务 4peers间歇性连接并更改ip地址 5复杂的管理
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 服务器进程 等待联系的进程▪ aside: applications with P2P architectures have client processes & server processes采用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 to deliver message to socket at receiving process进程从socket收发信息发送 发送进程依靠收信一侧的传输基础设施,将信息传送到接受进程的socket
Addressing processes ▪ to receive messages, process must have identifier ▪ host device has unique 32- bit IP address 为接收信息,进程必须有标识符 主机设备有唯一的32位ip地址
运行进程的主机的ip地址不足以识别进程 因为同一主机能运行多进程
▪ identifier includes both IP address and port numbers associated with process on host标识符包括与主机进程相关的ip地址和端口号. ▪ example port numbers: • HTTP server: 80 • mail server: 25 ▪ to send HTTP message to gaia.cs.umass.edu web server: • IP address: 128.119.245.12 • port number: 80 ▪ more shortly…
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 & respond to messages何时如何发送和响应信息的规则 open protocols开放协议: ▪ defined in RFCs ▪ allows for interoperability被RFCs定义 允许互操作 ▪ e.g., HTTP, SMTP proprietary protocols专有协议: ▪ e.g., Skype