会话,HTTP连接之间的区别? [英] Difference between Session, HTTP Connection?

查看:171
本文介绍了会话,HTTP连接之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读.看完书后,我发现自己现在对我的基础知识非常困惑.请帮助我,因为它涉及到网络和JSP的基础知识. Servlets

I have been reading this and this. After reading I found myself very confused with my basics now. Please help me out as it involves the basics of networking and JSPs & Servlets

考虑这种假设情况:

如果我在某些浏览器上打开了www.xyz.com,但当天却没有在该页面上执行任何操作.

If I open some www.xyz.com on some browser and don't do anything on that page for day.

Q.1如果第二天我从该页面请求某些内容,那意味着相同的连接仍然存在.考虑连接:保持活动在那里.

Q.1 Would that mean that same connection still exists if next day I request something from that page. Considering Connection: keep-alive is there.

Q.2会话在这种情况下如何工作-我发现,如果会话过期,连接也将过期,那么HTTP连接和会话之间有什么区别?就像当我们在同一浏览器中打开Facebook的多个标签时会发生什么情况(这是同一会话,但连接不同?我正确吗?)

Q.2 How does session works in this context -I have found that if session gets expired so will connection, so what is the difference between HTTP Connection and Session ? Like what happens when we open multiple tab of Facebook in same browser (It is same session but different connection ? Am I correct ?)

Q.3如本文章

HTTP 1.1标准的一项重大改进是持久连接.在HTTP 1.0中,在单个请求/响应周期之后,将关闭Web客户端与服务器之间的连接.在HTTP 1.1中,连接保持活动状态,并可以重复用于多个请求.持久连接可以明显减少通信延迟,因为客户端不需要在每次请求后重新协商TCP连接.

A major improvement in the HTTP 1.1 standard is persistent connections. In HTTP 1.0, a connection between a Web client and server is closed after a single request/response cycle. In HTTP 1.1, a connection is kept alive and reused for multiple requests. Persistent connections reduce communication lag perceptibly, because the client doesn't need to renegotiate the TCP connection after each request.

浏览器如何保持持久连接?

How does browser maintain a persistent connection ?

注意:如果有人可以以此方式回答这个问题,那会更好. >

NOTE : It would be better if someone could answer this question this way

推荐答案

要回答您的问题:

A1:否,第二天不存在联系. 保持活动状态"(在HTTP中)的值通常很低,无法整日保持正常运行.

A1: No, next day connection won't be there. Keep-Alive (in HTTP) values are usually low enough to not make it through the day.

A2:会话在服务器端维护.它与通信的保持活动"无关.它的有效期有一个单独的值(取决于您的配置方式).您是正确的:不同的选项卡,相同的会话,不同的连接.通常,使用通用Cookie将会话粘合在一起.因此,当您清洁Cookie时,通常会松开所有会话.

A2: Session is maintained server side. It has nothing to do with communication's Keep-Alive. It has a separate value for its expiry time (depends on how you configure it). You are correct: different tabs, same session, different connections. Usually sessions are glued together using common cookies. That's why when you clean your cookies, you usually loose all your sessions.

A3:浏览器根本不会关闭TCP/IP连接.就是这样.

A3: Browser simply does not close the TCP/IP connection. That's how it does it.

这篇关于会话,HTTP连接之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆