I am making HTTP requests too frequently and after some time getting this Exception:
java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)
I have gone through all of this related post.
But I don't get how to solve this. They have mentioned to clear the DNS cache, but I need to clear it in runtime, so that my execution does not stop working, which is not possible in Android.
Can anybody tell me the solution.
Here is my log:
06-04 11:14:08.119: W/System.err(8338): java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out) 06-04 11:14:08.139: W/System.err(8338): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:552) 06-04 11:14:08.139: W/System.err(8338): at libcore.io.IoBridge.recvfrom(IoBridge.java:516) 06-04 11:14:08.139: W/System.err(8338): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:489) 06-04 11:14:08.139: W/System.err(8338): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46) 06-04 11:14:08.139: W/System.err(8338): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:241) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:428) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.AbstractHttpClient$1.executeRequestSending(AbstractHttpClient.java:608) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.naf.redirect.NafRequestExecutorWrapperRedirectionHandler.executeRequestSendingUsual(NafRequestExecutorWrapperRedirectionHandler.java:96) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.naf.redirect.NafRequestExecutorWrapperRedirectionHandler.executeRequestSending(NafRequestExecutorWrapperRedirectionHandler.java:73) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.naf.auth.NafHttpAuthStrategyDefault.sendFirstRequest(NafHttpAuthStrategyDefault.java:488) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.naf.auth.NafHttpAuthStrategyDefault.performAuthExecutionUnsafe(NafHttpAuthStrategyDefault.java:389) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.naf.auth.NafHttpAuthStrategyDefault.performAuthExecution(NafHttpAuthStrategyDefault.java:200) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:557) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:509) 06-04 11:14:08.139: W/System.err(8338): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)