9

What is the difference between setSocketTimout, setConnectTimout and setConnectionRequestTimeout?

RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT) .setSocketTimeout(500) .setConnectTimeout(500) .setConnectionRequestTimeout(500) .build(); 
1
  • So what did you end up using ? A socket timeout of 500 seems a bit extreme, what if the network is slow ? Commented Nov 22, 2017 at 13:58

2 Answers 2

13

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.

Sign up to request clarification or add additional context in comments.

1 Comment

What would you use for a typical application, 500 millis seems a bit short.
0

ConnectTimeOut:- Refers the maximum time in milliseconds client will wait for connection establishment with server. Within give time the server must have established a connection with Client other it will throw an Exception.

SocketTimeout:- It defines maximum idle/ inactivity time in milliseconds between two consecutive data packets.

refer javadocs for more details

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.