I am sending a request over http. Connection time out and read time out are set to 30000ms. What is the maximum time after which i receive a response? Is it combined read + connection timeouts ? My doubt is when does read timeout start, after acquiring the connection or from the time we start to try establishing the connection? Will the connection be terminated after the configured connection time out even is connection is established?
The difference between the two timeouts are clear but exactly when they are taken into consideration is not clear for me.
con.setConnectTimeout(30000);
con.setReadTimeout(30000);
connectTimeout
limits the time that connection establishement can take, while readConnectionTimeout
says how long you can wait between datapackets (consecutive reads) after connection is established.
So first, you try to establish the connection and limits that process to connectTimeout
. After connection establishement, you read incoming data using readConnectionTimeout
.
The second one, will not limit the overall time of data reading operation. The total read time can be no longer then packets_to_be_send * readConnectionTimeout