8

What is the difference between setSocketTimout, setConnectTimout and setConnectionRequestTimeout?

RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
            .setSocketTimeout(500)
            .setConnectTimeout(500)
            .setConnectionRequestTimeout(500)
            .build();
Steve
  • 53,375
  • 33
  • 96
  • 141

2 Answers2

12

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.

Hongyi Li
  • 1,059
  • 2
  • 11
  • 19
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

Red Boy
  • 5,429
  • 3
  • 28
  • 41