Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache HTTP - setSocketTimout vs setConnectTimout vs setConnectionRequestTimeout

What is the difference between setSocketTimout, setConnectTimout and setConnectionRequestTimeout?

RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
            .setSocketTimeout(500)
            .setConnectTimeout(500)
            .setConnectionRequestTimeout(500)
            .build();
like image 482
Steve Avatar asked Aug 31 '16 17:08

Steve


People also ask

What is setConnectionRequestTimeout?

setConnectionRequestTimeout(int connectionRequestTimeout) Set the timeout in milliseconds used when requesting a connection from the connection manager using the underlying RequestConfig . void. setConnectTimeout(int timeout) Set the connection timeout for the underlying RequestConfig .

What is setSocketTimeout?

setSocketTimeout eventually calls socket. setSoTimeout which is explained in this answer. The ConnectionTimeToLive determines the maximum age of a connection (after which it will be closed), regardless of when the connection was last used.

What is read timeout in HTTP client?

timeout) – the time waiting for data – after establishing the connection; maximum time of inactivity between two data packets. the Connection Manager Timeout (http. connection-manager. timeout) – the time to wait for a connection from the connection manager/pool.

How do I set timeout in HTTP client?

The default value is 100,000 milliseconds (100 seconds). To set an infinite timeout, set the property value to InfiniteTimeSpan. A Domain Name System (DNS) query may take up to 15 seconds to return or time out.


1 Answers

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

Socket timeout is the timeout to receive data.

The method setConnectionRequestTimeout however is specific for configuring the connection manager. It returns the timeout in milliseconds used when requesting a connection from the connection manager. A timeout value of zero is interpreted as an infinite timeout.

like image 113
Hongyi Li Avatar answered Nov 08 '22 23:11

Hongyi Li