搜尋

首頁  >  問答  >  主體

android - Asyhttpclient设置了超时,但是还是要很长时间才会响应连接失败

请问下,Asyhttpclient使用setTimeOut方法设置了超时,为啥还是会等很长时间才会响应onFailure的方法

高洛峰高洛峰2886 天前587

全部回覆(2)我來回復

  • 高洛峰

    高洛峰2017-04-17 17:46:18

    仔細看看文檔,檢查一下程式碼,注意以下幾個方法的差異

    setTimeout(int value)
    

    Set both the connection and socket timeouts. By default, both are set to 10 seconds.

    
    
    setConnectTimeout(int value)
    

    Returns current connection timeout limit (milliseconds). By default, this is set to 10 seconds.

    
    
    setMaxRetriesAndTimeout(int retries, int timeout)
    

    Sets the maximum number of retries and timeout for a particular Request.

    回覆
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:46:18

    最好別用這個庫了,已經過時了,用okhttp/retrofit

    回覆
    0
  • 取消回覆