连接和连接请求超时

连接和连接请求超时

问题描述:

我正在使用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.