Skip to content Skip to sidebar Skip to footer

Sotimeout Not Working In A Multipart Http Post On Android 2.1

I am using the apache httpclient that ships with the android sdk to upload a file on server using multipart http post. The problem is that when i turn off the wifi connection on my

Solution 1:

Try this:

Assuming u have a httpClient object which is a instance of AndroidHttpClient or DefaultHttpClient

HttpParamshttpParams= httpClient.getParams();
httpParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, Timeout in milli seconds);

httpParams you get is a reference object so it executing setIntParameter will fix the issue

Unless you real have a special requirement for custom timeouts prefer using AndroidHttpClient it is very useful and solves most of our problems :) good luck

Solution 2:

I think you should use

HttpParamslHttpParams=newBasicHttpParams();
HttpConnectionParams.setConnectionTimeout(lHttpParams, 3000);
HttpConnectionParams.setSoTimeout(lHttpParams, 3000);

Best Regards,~Anup

Post a Comment for "Sotimeout Not Working In A Multipart Http Post On Android 2.1"