HttpClient
has a way to set connection and socket timeout (setConnectionTimeout()
and setTimeout()
) according to the HttpClient javadocs.
Connection timeout
is the timeout until a connection with the server is established.
Socket timeout
is the timeout to receive data (socket timeout).
Example:
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…