Commit 897655b87e5ed636f4887ee791a8606bd6a43814
1 parent
2681581a
timeout
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java
@@ -49,6 +49,9 @@ public class NetworkThread extends AsyncTask<Void, Void, JSONObject> { | @@ -49,6 +49,9 @@ public class NetworkThread extends AsyncTask<Void, Void, JSONObject> { | ||
49 | HttpURLConnection httpCo = (HttpURLConnection) mUrl.openConnection(); | 49 | HttpURLConnection httpCo = (HttpURLConnection) mUrl.openConnection(); |
50 | httpCo.setDoOutput(true); | 50 | httpCo.setDoOutput(true); |
51 | 51 | ||
52 | + httpCo.setConnectTimeout(20000); | ||
53 | + httpCo.setReadTimeout(20000); | ||
54 | + | ||
52 | httpCo.connect(); | 55 | httpCo.connect(); |
53 | 56 | ||
54 | boolean debut = true; | 57 | boolean debut = true; |
@@ -87,7 +90,7 @@ public class NetworkThread extends AsyncTask<Void, Void, JSONObject> { | @@ -87,7 +90,7 @@ public class NetworkThread extends AsyncTask<Void, Void, JSONObject> { | ||
87 | 90 | ||
88 | httpCo.disconnect(); | 91 | httpCo.disconnect(); |
89 | } catch (Throwable t) { | 92 | } catch (Throwable t) { |
90 | - System.out.println(t.toString()); | 93 | + System.out.println("Exception: " + t.toString()); |
91 | } | 94 | } |
92 | 95 | ||
93 | return json; | 96 | return json; |