HTTP服务器检测到来自HTTP客户端的断开的网络连接 [英] HTTP server detecting a broken network connection from a HTTP client

查看:429
本文介绍了HTTP服务器检测到来自HTTP客户端的断开的网络连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,其中向服务器发出HTTP请求后,客户端退出(或网络连接中断),然后客户端完全接收到响应.

I have an web application in which after making a HTTP request to the server, the client quits ( or network connection is broken) before the response was completely received by the client.

在这种情况下,应用程序的服务器端需要执行一些清理工作.是否有内置于HTTP协议中的方法来检测这种情况.服务器如何知道客户端是否仍在等待响应或已退出?

In this scenario the server side of the application needs to do some cleanup work. Is there a way built into HTTP protocol to detect this condition. How does the server know if the client is still waiting for the response or has quit?

谢谢 维杰·库玛(Vijay Kumar)

Thanks Vijay Kumar

推荐答案

不,协议没有内置任何功能可进行此操作(毕竟,您尚无法确定客户端本身是否已收到响应,或仅是下游代理).

No, there is nothing built in to the protocol to do this (after all, you can't tell whether the response has been received by the client itself yet, or just a downstream proxy).

请您的客户再次发出请求,以确认它已收到并存储了原始回复.如果没有及时确认,请运行清理.

Just have your client make a second request to acknowledge that it has received and stored the original response. If you don't see a timely acknowedgement, run the cleanup.

但是,请确保您了解两位将军问题的含义.

However, make sure that you understand the implications of the Two Generals' Problem.

这篇关于HTTP服务器检测到来自HTTP客户端的断开的网络连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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