07-28 12:41:40.953: W/System.err(3386): java.net.SocketException: Connection reset by peer
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method)
07-28 12:41:40.953: W/System.err(3386): at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85)
07-28 12:41:40.953: W/System.err(3386): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:166)
07-28 12:41:40.953: W/System.err(3386): at java.io.BufferedInputStream.read(BufferedInputStream.java:225)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.readLine(HttpURLConnectionImpl.java:660)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.readResponseHeaders(HttpURLConnectionImpl.java:690)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1040)
07-28 12:41:40.953: W/System.err(3386): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:512)
07-28 12:41:40.953: W/System.err(3386): at com.android.epaisa.Info.submitInfo(Info.java:168)
07-28 12:41:40.953: W/System.err(3386): at com.android.epaisa.Info.onClick(Info.java:62)
07-28 12:41:40.953: W/System.err(3386): at android.view.View.performClick(View.java:2485)
07-28 12:41:40.953: W/System.err(3386): at android.view.View$PerformClick.run(View.java:9080)
07-28 12:41:40.953: W/System.err(3386): at android.os.Handler.handleCallback(Handler.java:587)
07-28 12:41:40.953: W/System.err(3386): at android.os.Handler.dispatchMessage(Handler.java:92)
07-28 12:41:40.953: W/System.err(3386): at android.os.Looper.loop(Looper.java:130)
07-28 12:41:40.953: W/System.err(3386): at android.app.ActivityThread.main(ActivityThread.java:3687)
07-28 12:41:40.953: W/System.err(3386): at java.lang.reflect.Method.invokeNative(Native Method)
07-28 12:41:40.953: W/System.err(3386): at java.lang.reflect.Method.invoke(Method.java:507)
07-28 12:41:40.953: W/System.err(3386): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
07-28 12:41:40.960: W/System.err(3386): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
07-28 12:41:40.960: W/System.err(3386): at dalvik.system.NativeStart.main(Native Method)
发生错误的行是
InputStream is = conn.getInputStream();
连接是有效的流
请帮我解决问题。尝试访问 JSON 对象时出现此错误。手动检查 URL 后,结果符合预期。我正在尝试发送一个 jpg 图像文件,将其压缩为字节数组,然后通过 Internet 发送。谢谢并恭祝安康,