连接和连接请求超时 [英] Connection and connection request timeout

查看:137
本文介绍了连接和连接请求超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Http Apache Components来执行http交互。我需要调整我的http客户端。为此,我有两个参数:连接超时和连接请求超时。在图书馆文档和源代码中(没有找到评论)我没有找到这个术语的定义。我需要知道他们究竟是什么意思。可能是他们在HTTP协议文档中定义但我找不到它。所以,我的问题是这两个术语是什么意思以及它们如何相互区别。

I am using Http Apache Components to perform the http interactions. I need to adjust my http client. For this purpose I have two parameters: connection timeout and connection request timeout. In library documentation and in source code(no comments were found) I didn't found definition of this terms. I need to know what do they exactly mean. May be they were defined in HTTP protocol documentation but I can't find it. So, my question is what do this two terms mean and how they distinct from each other.

推荐答案

HttpClient 有一种设置连接和套接字超时的方法( setConnectionTimeout() setTimeout())根据 http://hc.apache.org/ httpclient-3.x / apidocs / org / apache / commons / httpclient / HttpClient.html

HttpClient has a way to set connection and socket timeout (setConnectionTimeout() and setTimeout()) according to http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpClient.html

连接超时是与服务器建立连接之前的超时时间。

Connection timeout is the timeout until a connection with the server is established.

套接字超时是接收超时数据(套接字超时)。

Socket timeout is the timeout to receive data (socket timeout).

示例:

假设您指向浏览器访问网页。如果服务器在X秒内没有响起,则会发生连接超时。但是如果它建立了连接,那么服务器将开始处理浏览器的结果。如果它在Y秒内没有结束此处理,则会发生套接字超时。

Let's say you point your browser to access a web page. If the server does not anwser in X seconds, a connection timeout will occur. But if it establishes the connection, then the server will start to process the result for the browser. If it does not ends this processing in Y seconds, a socket timeout will occur.

这篇关于连接和连接请求超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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