阻止请求
带有阻止请求的服务器连接是什么意思?
谢谢你!
What does a server connection with a blocking request mean?
Thank You!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
带有阻止请求的服务器连接是什么意思?
谢谢你!
What does a server connection with a blocking request mean?
Thank You!
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
这意味着,当您向服务器发出请求时,您将等待收到服务器的回复(阻塞)。
这种方法的优点是期望请求完成的代码将确保请求已完成。
缺点是您的代码在请求完成之前会“挂起”,并且请求可能永远不会完成,从而导致线程和/或进程挂起。
通常,阻塞请求都会伴随超时,因此在一段时间后,如果没有给出响应,调用将返回错误,指示超时已过,您应该认真处理这种情况。
网页请求是阻塞请求的一个示例。当您在浏览器中输入 www.google.com 时,您的浏览器会向 Google 的网络服务器发出阻止请求,等待显示响应。如果(出于某种疯狂的原因)谷歌没有响应,您将收到超时错误。
It means, when you make a request to the server, you wait until you hear back from it (blocking).
The advantage of this approach is that code that expects the request to complete will be ensured that the request has completed.
The downsides are that your code is "hung" until the request completes, and there is a chance that the request might not ever complete, which results in a hung thread and/or process.
Typically blocking requests are accompanied by timeouts, so after period of time, if no response is given, the call returns with an error indicated a timeout has elapsed, and you should diligently handle that case.
Web page requests are an example of a blocking request. When you type www.google.com into your browser, your browser makes a blocking request to Google's web server, waiting to display the response. If (for some crazy reason) google doesn't respond, you'll get a timeout error.