在论坛上看到,有人用httpParams中的超时。我也这样试试 但是没有反应 请教各位究竟是错在哪里了,我的代码如下:
public final static InputStream getStream(String args) {
InputStream stream = null;
BasicHttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, REQUEST_TIMEOUT);
HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
HttpClient client = new DefaultHttpClient(httpParams);
HttpGet get = new HttpGet(args);
try {
HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = response.getEntity();
stream = entity.getContent();
}
return stream;
} catch (Exception e) {
e.printStackTrace();
return stream;
}
}
------解决方案--------------------
http://hi.baidu.com/qteqpid_pku/blog/item/f77356c27f6aaa0f0ff47714.html
不知道是不是你想要的