What is the difference between setSocketTimout
, setConnectTimout
and setConnectionRequestTimeout
?
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
.setSocketTimeout(500)
.setConnectTimeout(500)
.setConnectionRequestTimeout(500)
.build();
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 .
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With