HTTP持久连接与TCP套接字连接 [英] HTTP persistent connection vs TCP socket connection
问题描述
来自维基百科上的这篇文章:
From this article on Wikipedia:
在HTTP 1.0中,Keepalive消息未正式支持
。在HTTP 1.1中,所有
连接都被认为是持久的,
除非另有声明。
Keepalive messages were not officially supported in HTTP 1.0. In HTTP 1.1 all connections are considered persistent, unless declared otherwise.
- 这是否意味着使用这个
机制我实际上可以模拟
TCP套接字连接? - 使用此功能可以将Server
推送数据发送给客户端吗? - 是否所有HTTP连接,甚至是
一个我用来连接到堆栈
溢出HTTP持久性? - COMET 技术
服务器推送使用
HTTP持久连接机制将
数据推送到客户端? - Does this mean that using this mechanism I can actually simulate a TCP socket connection?
- Using this can I make a Server "push" data to a client?
- Are all HTTP connections, even the one I am using to connect to Stack Overflow "HTTP persistent"?
- Does the COMET technology of server push use this mechanism of HTTP persistent connection to push data to clients?
- 这是否意味着使用此机制我实际上可以模拟
TCP套接字连接? - 使用此功能可以使服务器推送 数据发送给客户?
- 是否所有HTTP连接,甚至是我用来连接Stack
OverflowHTTP persistent? - 服务器推送的COMET技术是否使用HTTP
持久连接的这种机制将数据推送到
客户端?
推荐答案
不是真的,套接字有 MANY 更多功能和灵活性。
Not really, sockets have MANY more features and flexibility.
不直接,仍然 a请求/响应协议;持久连接只是意味着客户端可以使用相同的底层套接字发送多个请求并接收相应的响应。
Not directly, it's still a request/response protocol; the persistent connection just means the client can use the same underlying socket to send multiple requests and receive the respective responses.
除非您的浏览器(或特殊服务器)另有说明,否则是。
Unless your browser (or a peculiar server) says otherwise, yes.
有点(至少用于流式传输),但顶部有很多生奶油。还有其他Comet实现方法,例如隐藏的iframe和AJAX长轮询,可能不需要持久连接(无论如何都会给一些防火墙& c拟合; - )。
Kinda (for streaming, at least), but with a lot of whipped cream on top. There are other Comet implementation approaches, such as hidden iframes and AJAX long polling, that may not require persistent connections (which give some firewalls &c the fits anyway;-).
这篇关于HTTP持久连接与TCP套接字连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!