We are not getting that type of delay. You may to try URLConnection.
Just a thought .....
The following is an example.
// Post request
private String doPost (String request) {
URLConnection urlConn;
URL destURL;
DataOutputStream outStream;
DataInputStream inStream;
int c;
StringBuffer sBuffer = new StringBuffer ();
if (request == null)
return null;
if (url == null)
return null;
handleTrace ("request:" + request);
try {
destURL = new URL (url);
urlConn = destURL.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
urlConn.setRequestProperty("Content-length",
"" + request.length());
outStream = new DataOutputStream (urlConn.getOutputStream());
outStream.writeBytes(request);
outStream.close ();
inStream = new DataInputStream (urlConn.getInputStream());
while ((c = inStream.read()) >= 0) {
sBuffer.append((char) c);
}
} catch (Exception ex) {
handleException (ex);
}
return ((String) sBuffer.toString());
}
This is taken from the Jt.JtURL component invoke by Jt.JtHttpAdapter.
It seems to have a better response time.
On Nov 16, 11:22 am, SImplyG2010 <[email protected]> wrote:
> Daniel what do you use instead? The weird thing is that the timings
> shown above are purely for the execute call not the creation of the
> client object or anything.
>
> On Nov 16, 11:09 am, Daniel Drozdzewski <[email protected]>
> wrote:
>
> > On Tue, Nov 16, 2010 at 3:31 PM, SImplyG2010
>
> > <[email protected]> wrote:
> > > Good morning everyone,
>
> > > I am having a hugely annoying issue with delays using HTTPClient and
> > > post the first time I call execute on the client the response takes 5
> > > seconds to come back. Subsequent calls take around 100 to 200 ms. I am
> > > using the Apache client so does anyone know why this takes so long?
> > > The client setup looks like below
>
> > Did you look at DDMS, what happens, when you cause the first call?
> > I never used HttpClient. Since it does a lot, it probably is a bit
> > heavy, so class loading and instantiating could take time.
> > Once in memory it simply works.
>
> > It is just a stab in the darkness.
>
> > --
> > Daniel
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en