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
?