gpt4 book ai didi

java.net.SocketException : recvfrom failed: ETIMEDOUT (Connection timed out) 异常

转载 作者:太空狗 更新时间:2023-10-29 15:28:24 24 4
gpt4 key购买 nike

我过于频繁地发出 HTTP 请求,一段时间后出现此异常:

java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)

我已经经历了所有这些related post .

但我不知道如何解决这个问题。他们提到要清除 DNS 缓存,但我需要在运行时清除它,以便我的执行不会停止工作,这在 Android 中是不可能的。

谁能告诉我解决办法

这是我的日志:

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)

最佳答案

参见 http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg23588.html :“如果 TCP 连接超时,您可以得到这个,无论是通过保持 Activity 超时还是协议(protocol)达到最大传输重试次数。”它与 DNS 没有任何关系。

关于java.net.SocketException : recvfrom failed: ETIMEDOUT (Connection timed out) 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16912132/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com