0

I have a problem and I don't know how to get rid of it. Sometimes (that's the main problem, it's just sometimes) I have this exception :

07-23 01:18:14.198: W/System.err(31750): java.net.SocketTimeoutException
07-23 01:18:14.198: W/System.err(31750):    at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
07-23 01:18:14.198: W/System.err(31750):    at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
07-23 01:18:14.198: W/System.err(31750):    at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okio.Okio$2.read(Okio.java:116)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okio.RealBufferedSource.indexOf(RealBufferedSource.java:150)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:97)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:202)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:119)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:798)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:405)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:349)
07-23 01:18:14.198: W/System.err(31750):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getHeaderFieldKey(HttpURLConnectionImpl.java:174)

I know what is basically a socketTimeoutException, but here the problem is that it can't happen (or at least not so much) as the server is local and connected to the same router where the phone is connected (I tried with a different router, same problem). And off course the server is working perfectly (When i have an error in the app the log on the server show that the server never receive any request). So what can make that I have sometimes (2 - 10 times per day) a java.net.SocketTimeoutException that I can't reproduce (just trying again the exact same request and it's work fine).

I m using delphi TNetHttpClient (don't know if it's matter) that internally use HttpURLConnection

Also what can I do to debug this error to find what is the real reason of the java.net.SocketTimeoutException ?

7
  • airbrake.io/blog/java-exception-handling/sockettimeoutexception check this , if this helps Commented Jul 23, 2018 at 8:56
  • @AnjaniMittal thanks unfortunatly this article is too much generic to socket it's didn't help :( I don't use socket directly, just by httpUrlConnection, my problem is to understand what cause the socket timeout because is surely in the software not in hardware/network Commented Jul 23, 2018 at 9:18
  • 1
    Is this happening on one particular device, or more than one? Commented Jul 23, 2018 at 10:14
  • Also, you might like to look at: stackoverflow.com/questions/9094227/…. They talk about a "close" method, but I can't seem to find any. Changing the read timeout perhaps might help? Commented Jul 23, 2018 at 10:26
  • @DaveNottage: it's happening in several device, but only for my delphi android app. i never had such error in any other app that i used Commented Jul 23, 2018 at 10:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.