I Want to know what is the recommended value for methods setConnectionTimeou()
and
setReadTimeOut()
for HttpURL connection? I know these value depends upon the server and what task server is performing. but still i want to know the recommended values for these method.

- 391
- 4
- 21
-
If you don't know, then just leave it at the defaults. – lionscribe Aug 10 '16 at 05:30
-
Thanks, but we talking about the recommended values for these methods. – user3586231 Aug 10 '16 at 06:43
2 Answers
It's hard to answer such question without knowing the typical response time. Users are fairly accustomed to wait a few seconds when using mobile devices whilst on mobile networks.
Personally if the timeout is between 10 - 15s I will consider it a normal latency, if it is 20s or more, I will most likely quit the app.
From Default Documentation
Both setConnectTimeout (int timeout) and setReadTimeout (int timeout) From API 1
A SocketTimeoutException is thrown if the connection could not be established in this time. Default is 0 which stands for an infinite timeout.
see this link its give you more idea about this.

- 2,117
- 2
- 16
- 33
You can do it this example: Your method How to add parameters to HttpURLConnection using POST
OR
You can follow this other form https://developer.android.com/reference/java/net/HttpURLConnection.html

- 1
- 1

- 51
- 3