user1534735
user1534735

Reputation:

java.net.SocketException: Connection reset by peer

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)

Line where error is occurring is

InputStream is = conn.getInputStream();

The connection is valid stream

Please help me in solving the issue . I am getting this error while trying to access a JSON object. upon manually checking the URL the result is as expected. I am trying to send an jpg image file compressing it converting it into byte array and then sending over the internet. Thanks and Regards,

Upvotes: 2

Views: 5245

Answers (1)

user1534735
user1534735

Reputation:

Guys the error was occurring because of timeout due to slow response in the internet connection and thus the connection was getting reset as per the coding at the backend.

Upvotes: 3

Related Questions