在论坛上看到,有人用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;  
        }  
    }