android socket读取时文件号错误

时间:2015-10-21 08:36:09

标签: android sockets okhttp

伙计们,我试图从服务器下载文件,但有时它会给出这个例外。

java.net.SocketException: recvfrom failed: EBADF (Bad file number)
                at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:552)
                at libcore.io.IoBridge.recvfrom(IoBridge.java:516)
                at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
                at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
                at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
                at okio.Okio$2.read(Okio.java:139)
                at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
                at okio.RealBufferedSource.read(RealBufferedSource.java:50)
                at com.squareup.okhttp.internal.http.HttpConnection$ChunkedSource.read(HttpConnection.java:464)
                at okio.RealBufferedSource$1.read(RealBufferedSource.java:371)
                at java.io.InputStream.read(InputStream.java:163)

1 个答案:

答案 0 :(得分:0)

你取消了电话吗?这个异常可能表示套接字在取消呼叫后被带走。