《计算机网络 自顶向下方法》读书笔记(四)

来源:互联网 发布:淘宝名词解释大全 编辑:程序博客网 时间:2024/04/30 10:23

P2P的自扩展性(self-scalability):

For example, in a P2P file-sharing application, although each peer generates workload by requesting files, each peer also adds service capacity to the system by distributing files to other peers.

这里·····有点理解不能啊·····

后面列举的P2P面临的三个问题,相信爱思考的人都能想到。我觉得这本书最好的地方是,他提供了相关的论文检索而不是随口一提。


The process which initiates the communication is the client; the process that waits to be contacted is the server.

譬如反向连接,就是远程控制端作为服务器,被控端作为客户端,但实际上是被控端提供的服务。


Thus, HTTP is only one piece (albeit, an important piece) of the Web application. As another example, an Internet e-mail application also has many components, including mail servers that house user mailboxes; mail clients (such as Microsoft Outlook) that allow users to read and create messages; a standard for defining the structure of an e-mail message; and application-layer protocols that define how messages are passed between servers, how messages are passed between servers and mail clients, and how the contents of message headers are to be
interpreted. The principal application-layer protocol for electronic mail is SMTP (Simple Mail Transfer Protocol) [RFC 5321].

这里邮件还需要哪些协议呢····


RTT值

we define the round-trip time(RTT), which is the time it takes for a small packet to travel from client to server
and then back to the client
. The RTT includes packet-propagation delays, packetqueuing delays in intermediate routers and switches, and packet-processing delays.

这里RTT是没有传输时延的哦~如果说是因为是从主机完整的发出数据报开始计算,那么不可能连路由器中的传输时延也不计算。所以应该是传输时延对于短分组而言可以忽略。实际上他特意说是短分组可能也是这个意思。

the client sends a small TCP segment to the server, the server acknowledges and responds with a small TCP segment, and,finally, the client acknowledges back to the server. The first two parts of the threeway handshake take one RTT. After completing the first two parts of the handshake,the client sends the HTTP request message combined with the third part of the three-way handshake (the acknowledgment) into the TCP connection. Once the request message arrives at the server, the server sends the HTML file into the TCP connection. This HTTP request/response eats up another RTT. Thus, roughly, the total response time is two RTTs plus the transmission time at the server of the HTML file.

这里说HTTP和TCP的三次握手混合在了一起。用wireshark验证一下:


我们可以看到两个相对序列号为0的TCP数据报,这分别是HTTP(80)和HTTPS(443)。这里仅追踪HTTP:

这里GET请求是作为第四个数据报而不是和ACK包一起发送的。为什么会出现这种不同呢?实际上我直觉上确实觉得这样还可以节省一次发包的时间呢。


With persistent connections, the server leaves the TCP connection open after sending a response. Subsequent requests and responses between the same client and server can be sent over the same connection. In particular, an entire Web page (in the example above, the base HTML file and the 10 images) can be sent over a single persistent TCP connection. Moreover,multiple Web pages residing on the same server can be sent from the server to the same client over a single persistent TCP connection. These requests for objects can be made back-to-back, without waiting for replies to pending requests (pipelining). Typically, the HTTP server closes a connection when it isn’t used for a certain time (a configurable timeout interval). When the server receives the back-to-back requests, it sends the objects back-to-back. The default mode of HTTP uses persistent connections with pipelining.

这里有一篇博文对于持续连接的叙述非常详尽:HTTP的长连接和短连接

他说到,在浏览器里并未广泛的使用流水线技术——因为需要HTTP请求顺序正确返回Response(也就是请求&响应采用FIFO模式),这容易导致Head-of-line blocking,即第一个请求的响应发送影响到了后边的请求。因为这个原因,HTTP流水线技术对性能的提升并不明显。



回车符是Carriage Return, C语言中是'\r' 换行符是Line Feed(C语言中是'\n' 回车换行符实际是两个字符, 就是\r\n,单纯的回车其实是回到一行最前方)。找到了一個關於CR和LF起源的小故事,感覺非常不錯:

改行Code(CR、LF、CR+LF)

How does a browser decide which header lines to include in a request message?How does a Web server decide which header lines to include in a response message? A browser will generate header lines as a function of the browser type and version (for example, an HTTP/1.0 browser will not generate any 1.1 header lines), the user configuration of the browser (for example, preferred language), and whether the browser currently has a cached, but possibly out-of-date, version of the object. Web servers behave similarly: There are different products, versions, and
configurations, all of which influence which header lines are included in response messages.

不知道这里,浏览器所发出的报文能否决定或影响服务器发给自身的报文的首部行呢?


HTML forms often use the GET method and include the inputted data (in the form fields) in the requested URL. For
example, if a form uses the GET method, has two fields, and the inputs to the two fields are monkeys and bananas, then the URL will have the structure www.somesite.com/animalsearch?monkeys&bananas.

找到了一片博文描述GET和POST的区别。

HTTP协议与HTML表单(再谈GET与POST的区别)

简单来说,就是GET设计的本意并不是用来对server进行修改。而POST提供更新服务器资源的功能。暂且没有时间看官方文档了,有机会再说吧。


The Content-Type: header line indicates that the object in the entity body is HTML text. (The object type is officially indicated by the Content-Type: header and not by the file extension.)

这里就是说Content-Type可以实际上与文件扩展名不一致喽?那么Content-Type是可以任意的吗?



这本书关于cookie的描述很简单,不过其实是计算机网络,尤其是对于WEB比底层的协议更加重要的概念。当然,很早以前我就知道,cookie是对用户隐私的侵害了,哈哈哈哈哈······

Cookie/Session机制详解


web cache(proxy server)

我一直以为代理服务器就是指VPN,但是又感觉哪里不对·······

Typically a Web cache is purchased and installed by an ISP. For example, a university might install a cache on its campus network and configure all of the campus browsers to point to the cache. Or a major residential ISP (such as AOL) might install one or more caches in its network and preconfigure its shipped browsers to point to the installed caches.

我看到这里又有了一个非常蠢的问题:ISP究竟是如何修改了proxy server的?我感觉浏览器的代理服务器都是需要手动配置的(也许可以用ISP提供的客户端自动配置?)。


R9.Recall that TCP can be enhanced with SSL to provide process-to-process security services, including encryption. Does SSL operate at the transport layer or the application layer? If the application developer wants TCP to be enhanced with SSL, what does the developer have to do?

这里中文版翻译的是UDP······可想而知我理解成了什么样····不过开开脑洞也不错·····



SMTP协议,用于邮件交换。这一章的POP3和IMAP我就PASS掉了,感觉这种协议被用到的频率还不如基于web的访问。按照这本书的说法,HTTP是一个拉协议(pull protocol),所以对于邮箱的访问完全可以用HTTP取代其他访问协议。

这个地方我开始理解有误,感觉中文读起来有点奇怪,不过不能算是翻译的问题:

Alice’s mail server must also deal with failures in Bob’s mail server.

他直译为Bob上的故障,实际上结合上下文应该是发送给Bob出现的故障感觉更舒服一点。当然,个人意见。


他提及SMTP是一种继承的技术(这是肯定的,因为电子邮件是最早被广泛使用的网络应用),尤其是SMTP只能用7位ASCII传输。这个地方很奇怪啊,显然大家都不可能容忍这种毫无效率的方式,稍微查了一下,RFC已经对SMTP提出了改进。

1.SMTP协议简单,没有认证等功能(RFC 1425——ESTMP)。

2.传输受限(RFC 1521,RFC 1522  ——MIME)。

这个地方翻译有点吊炸的感觉……他的标题是邮件报文格式和MIME,结果这一段英文版里全文就没提MIME一句……这是译者善意的补充吗?

As part of the dialogue, the client issued five commands: HELO (an abbreviation for HELLO), MAIL FROM, RCPT TO, DATA, and QUIT. These commands are self-explanatory.

这个自解释是什么意思,是指命令本身的意思可以通过词义表达吗……


有时间可以模拟一下SMTP协议给学校的SMTP服务器捣捣乱……


0 0