I've been suffering from the HttpClient hanging on me every now and
again and never returning the response. This is my HttpClient creation
code and the method which accesses it. It is accessed potentially via
the UI thread and other AsyncTasks.

Can anyone see anything here that looks suspicious which could cause
this kind of behaviour?


private static DefaultHttpClient httpClient;

private static void createHttpClient()
{
        HttpParams params = new BasicHttpParams();
        ConnManagerParams.setMaxTotalConnections(params, 4);
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);

        HttpConnectionParams.setConnectionTimeout(params, 8000);
        HttpConnectionParams.setSoTimeout(params, 8000);

        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));

        ClientConnectionManager cm = new ThreadSafeClientConnManager(params,
schemeRegistry);
        httpClient = new DefaultHttpClient(cm, params);
}


public synchronized static HttpResponse fetch(HttpRequestBase type)
throws ClientProtocolException, IOException
{
        return httpClient.execute(type);
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to