okhttp3 maximum connection timeout

余生长醉 提交于 2019-12-11 03:33:17

问题


I need help with timeouts in okhttp3. I configured the maximum connect, read and write timeout to 4 minutes like that:

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

totalSeconds = 240.000

but throws exception SocketTimeoutException in 2 minutes. Please someone have been in this situation? how can i solve it? Thanks in advance

来源:https://stackoverflow.com/questions/48735108/okhttp3-maximum-connection-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!