Timeout for Multipart HTTP post

1.9k Views Asked by At

How to set the timeout for HTTP multipart file post. I want to upload image to the server at the time internet connection is not there how to handle that situation?

1

There are 1 best solutions below

1
On

Finally i found the solution for that here is the code to set the timeout for HTTPClient

HttpParams httpParameters = new BasicHttpParams();

int timeoutConnection = 30000; HttpConnectionParams.setConnectionTimeout(httpParameters,timeoutConnection);

int timeoutSocket = 30000;

HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

HttpClient httpClient = new DefaultHttpClient(httpParameters);