如何设置HTTP多部分文件发布的超时。我想在没有互联网连接的情况下将图像上传到服务器如何处理这种情况?
答案 0 :(得分:0)
最后我发现这里的解决方案是设置HTTPClient超时的代码
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 30000; HttpConnectionParams.setConnectionTimeout(httpParameters,timeoutConnection);
int timeoutSocket = 30000;
HttpConnectionParams.setSoTimeout(httpParameters,timeoutSocket);
HttpClient httpClient = new DefaultHttpClient(httpParameters);