I followed the instructions of kuester2000's answer , but my timeout settings do not seem to work.
try { int timeout = 3000; URL myURL = //some valid URL AndroidHttpClient = AndroidHttpClient.newInstance("name"); HttpGet httpGet = new HttpGet(myURL.toExternalForm()); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, timeout); HttpConnectionParams.setSoTimeout(httpParams, timeout); HttpResponse response = httpClient.execute(httpGet); //... } catch (SocketTimeoutException e) { e.printStackTrace(); } catch (ConnectTimeoutException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //...
However, the timeout value does not change anything.
In the answer I linked, he also says:
The connection timeout throws "java.net.SocketTimeoutException: Socket not connected" and the socket timeout "java.net.SocketTimeoutException: operation timeout".
But I do not get either one or the other. Instead, I get "org.apache.http.conn.ConnectTimeoutException: connection to ... timeout"
so can anyone help me? where is the mistake?
jellyfish
source share