Jumat, 15 Maret 2019

OkHttp3 never timeout on slow internet

First of all, I have read so many questions regarding my question but it never gives me the solution. Here are some of the questions which I read regarding my question.

I also read this article regarding my question but it also never provide me the solution.

Problem

I am using Okhhtp3 library in my application for Web services. It's working fine but when the internet connection slow or unreliable connection It's stuck and never times out or never calls the timeout exception or failure method.

Here is the client code:


OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(20, TimeUnit.SECONDS)
.writeTimeout(20, TimeUnit.SECONDS)
.readTimeout(20, TimeUnit.SECONDS)
.retryOnConnectionFailure(false)
.build();

How can get the timeout exception or called failure method after 20 secs?

Please help me. Thanks



from OkHttp3 never timeout on slow internet

OkHttp3 never timeout on slow internet Rating: 4.5 Diposkan Oleh: Admin

0 komentar:

Posting Komentar

Popular Posts