java.net.SocketTimeoutException: timeout

前端 未结 6 915
余生分开走
余生分开走 2021-02-03 18:27

With OkHttp library, application is facing following SocketTimeoutException issue. If request size is less, then it is working fine(Less than 1MB). I a

6条回答
  •  深忆病人
    2021-02-03 18:36

    For OkHttp 3 the default value for OkHttp is 10 seconds. You can increase the timeout to 30 seconds.

    OkHttpClient client = new OkHttpClient();
    client.setConnectTimeout(30, TimeUnit.SECONDS); // connect timeout
    client.setReadTimeout(30, TimeUnit.SECONDS);    // socket timeout
    

提交回复
热议问题