改造中出现错误

时间:2017-01-13 11:57:34

标签: android retrofit retrofit2

如果我在我的Android应用程序中使用改装上传超过5 MB的文件,我会收到此错误:

java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer)
 W/System.err:     at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506)
 W/System.err:     at libcore.io.IoBridge.sendto(IoBridge.java:475)
 W/System.err:     at java.net.PlainSocketImpl.write(PlainSocketImpl.java:507)
 W/System.err:     at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
 W/System.err:     at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
 W/System.err:     at okio.Okio$1.write(Okio.java:80)
 W/System.err:     at okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
 W/System.err:     at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
 W/System.err:     at okio.RealBufferedSink.write(RealBufferedSink.java:46)
 W/System.err:     at okhttp3.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:286)
 W/System.err:     at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
 W/System.err:     at okio.RealBufferedSink.writeAll(RealBufferedSink.java:104)
 W/System.err:     at okhttp3.RequestBody$3.writeTo(RequestBody.java:118)
 W/System.err:     at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.java:171)
 W/System.err:     at okhttp3.MultipartBody.writeTo(MultipartBody.java:113)
 W/System.err:     at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:704)
 W/System.err:     at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:563)
 W/System.err:     at okhttp3.RealCall.getResponse(RealCall.java:241)
 W/System.err:     at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
 W/System.err:     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
 W/System.err:     at okhttp3.RealCall.access$100(RealCall.java:30)
 W/System.err:     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
 W/System.err:     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
 W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
 W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
 W/System.err:     at java.lang.Thread.run(Thread.java:856)
 W/System.err: Caused by: libcore.io.ErrnoException: sendto failed: ECONNRESET (Connection reset by peer)
 W/System.err:     at libcore.io.Posix.sendtoBytes(Native Method)
 W/System.err:     at libcore.io.Posix.sendto(Posix.java:146)
 W/System.err:     at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
 W/System.err:     at libcore.io.IoBridge.sendto(IoBridge.java:473)
 W/System.err:  ... 24 more

1 个答案:

答案 0 :(得分:0)

您要连接的服务器因任何原因关闭了连接。您需要与运行服务器的人员交谈,看看发生了什么。可能是无效请求,服务器损坏,格式无效等。这不是Retrofit的问题