I know volley have a Retry Policy,but what i know , this is for a socket timeout,not for a connection timeout, Apache HttpClient have setConnectionTimeout and setSoTimeout Method,is anyone know if i want to set connection timeout for volley framework.
Asked
Active
Viewed 1,567 times
2
-
1did u checked this [link](http://stackoverflow.com/questions/17094718/android-volley-timeout?answertab=active#tab-top) – W I Z A R D Sep 24 '14 at 07:58
2 Answers
2
you must open the HttpClientStack
under package com.android.volley.toolbox;
and then at the body of function performRequest
you can change the values of
HttpConnectionParams.setConnectionTimeout(httpParams, your time);
HttpConnectionParams.setSoTimeout(httpParams, your time);
hope it helps.

mmlooloo
- 18,937
- 5
- 45
- 64
-
Connection timeout is set to 5000 by default, but the actual time out happens after 40 seconds. How do I set the connection timeout. – Pranay Soni Apr 23 '18 at 07:12
1
If you want to set the Parameters of any existing HTTPClient (e.g. DefaultHttpClient or AndroidHttpClient) you can use setParams().
HttpGet httpGet = new HttpGet(url);
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
int timeoutSocket = 5000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);
HttpResponse response = httpClient.execute(httpGet);
// after this set the parameters
httpClient.setParams(httpParameters);
Refer this: How to set HttpResponse timeout for Android in Java

Community
- 1
- 1

Krupa Patel
- 3,309
- 3
- 23
- 28
-
-
then did you refer : http://stackoverflow.com/questions/17094718/android-volley-timeout ?? – Krupa Patel Sep 24 '14 at 08:05
-
I have seen this before i asked.But i think RetryPolicy is just for socket timeout, not for a connection timeout. maybe i am wrong understand the difference between connection timeout and socket timeout???so confused,,, – CoolCoffe Sep 24 '14 at 08:12
-