我用手机的2G网络,访问http请求,总是,超时,但是用本机访问浏览器,打开一下网站之类的是没有 问题的,不知道是怎么回事第一种方式
 DefaultHttpClient httpClient = new DefaultHttpClient();
            httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 1000*5);
            httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 1000*5);
            HttpPost httpPost = new HttpPost(url);
            ArrayList<BasicNameValuePair> postData = new ArrayList<BasicNameValuePair>();
            for (Map.Entry<String, String> m : data.entrySet()) {
                postData.add(new BasicNameValuePair(m.getKey(), m.getValue()));
            }            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postData, HTTP.UTF_8);
            httpPost.setEntity(entity);
            
            HttpResponse response = httpClient.execute(httpPost);
            if (response.getStatusLine().getStatusCode() == 200) {
              HttpEntity httpEntity = response.getEntity(); 
              return httpEntity.getContent();
            }第二种方式
 HttpPost httpPost = new HttpPost(url);
            DefaultHttpClient httpClient = new DefaultHttpClient();
            httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 30000);
            httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 30000);
            ArrayList<BasicNameValuePair> postData = new ArrayList<BasicNameValuePair>();
            for (Map.Entry<String, String> m : data.entrySet()) {
                postData.add(new BasicNameValuePair(m.getKey(), m.getValue()));
            }            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postData, HTTP.UTF_8);
            httpPost.setEntity(entity);
            
            HttpResponse response = httpClient.execute(httpPost);
            if (response.getStatusLine().getStatusCode() == 200) {
              HttpEntity httpEntity = response.getEntity(); 
              return httpEntity.getContent();
            }else{
             return null;
            }
两者用2G网络都访问超时,不管设置多长时间都会超时,但是用wife网络就没有问题