title: HTTP requests with HttpClient too slow?
body: <p>i'm trying to coding an android app that send some post values to a php file hosted at a dedicate server and store the array resoult</p>
  
  <p>the code is this</p>
  
  <pre><code>   HttpPost httppost;
      DefaultHttpClient httpclient;
  
      httppost = new HttpPost("http://IP/script.php"); 
      HttpParams param = new BasicHttpParams(); 
      param.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
  
  
    //  httppost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
  
      HttpProtocolParams.setContentCharset(param, "UTF-8");
  
      httpclient = new DefaultHttpClient(param);
  
      ResponseHandler &lt;String&gt; res=new BasicResponseHandler(); 
      List&lt;NameValuePair&gt; nameValuePairs;
  
      nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); 
      nameValuePairs.add(new BasicNameValuePair("id","1"));
      nameValuePairs.add(new BasicNameValuePair("api", "1"));
  
  
      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 
  Log.v("1",System.currentTimeMillis()+"");// Log to know the time diff
      String result= httpclient.execute(httppost, res);
  Log.v("2",System.currentTimeMillis()+""); //  Log to know the time diff
  </code></pre>
  
  <p>this code waste about 2.5seconds (on 3G or WiFi) to send the post and get just "ok" string  from server , even with good wifi this time down only to 2.2 / 2.0 seconds</p>
  
  <p>I ran a simple Ajax sendpost script in  my computer conected to internet through the same phone and 3G, it's take about .300ms to do the same stuff so ¿Same conection, same action, 2 seconds difference ?</p>
  
  <p>///<strong>***UPDATE</strong></p>
  
  <p>I tried again my jquery script on my computer (with a mobile  3G+/HDSPA conection) </p>
  
  <p>the average time response is about <strong>250ms</strong> but always the <strong>first request up to 1.7secs</strong>, i tried to send posts  with intervals of 30 seconds and i got 1.5 secs average time, then i tried to send a post with intervals of 2 seconds, the first was 1.41s and nexts 252ms </p>
  
  <p>here you guys can view the chart: <a href="http://i46.tinypic.com/27zjl8n.jpg" rel="nofollow">http://i46.tinypic.com/27zjl8n.jpg</a></p>
  
  <p>This same test with cable conection (standard home DSL) offers always a fixed time response of <strong>~170ms</strong> intervals regardless (not solid arguments here but IMHO maybe the first attempt is slightly slightly higher)</p>
  
  <p>So there is something out (or wrong) severely affecting mobile conections in the first attempt, Any idea guys?</p>