Skip to content Skip to sidebar Skip to footer

Make Execute() Of Httpdefaultclient Very Slow

I have massive performance problems with the execute method of the execute() method of the HttpDefaultClient. I'm currently using this to post data to a Server, receiving JSON and

Solution 1:

codes above works fine.

if i create an httpclient the following way:

DefaultHttpClienthttpClient=newDefaultHttpClient();
    // httpclient
    httpClient.getParams().setParameter(
            CoreConnectionPNames.CONNECTION_TIMEOUT, mConnectionTimeOut);
    httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
            mSocketTimeOut);

for first time to post data to server and got response , it cost me 10--20 seconds.

but if i create an HttpClient following the answer above. when first time to post data to server and got response , it cost just 4 seconds,and i think it works fine .

Post a Comment for "Make Execute() Of Httpdefaultclient Very Slow"