首页 > 代码库 > java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
11-22 14:49:16.870: WARN/System.err(3581): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:542)
11-22 14:49:16.870: WARN/System.err(3581): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
11-22 14:49:16.870: WARN/System.err(3581): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
11-22 14:49:16.870: WARN/System.err(3581): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
11-22 14:49:16.870: WARN/System.err(3581): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:428)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
11-22 14:49:16.870: WARN/System.err(3581): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
11-22 14:49:16.870: WARN/System.err(3581): at com.cplatform.android.cmsurfclient.download.provider.AndroidHttpClient.execute(AndroidHttpClient.java:172)
11-22 14:49:16.870: WARN/System.err(3581): at com.cplatform.android.cmsurfclient.download.provider.DownloadThread.run(DownloadThread.java:205)
11-22 14:49:16.900: WARN/System.err(3581): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
11-22 14:49:16.900: WARN/System.err(3581): at libcore.io.Posix.recvfromBytes(Native Method)
11-22 14:49:16.900: WARN/System.err(3581): at libcore.io.Posix.recvfrom(Posix.java:131)
11-22 14:49:16.900: WARN/System.err(3581): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
11-22 14:49:16.900: WARN/System.err(3581): at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
11-22 14:49:16.900: WARN/System.err(3581): ... 18 more
原因:1、服务器中断
2、网络连接非常慢的时候
3、下载大文件时,频繁请求服务器,请求的端口一直被占用
java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)