HttpClient execute keeps giving ConnectTimeoutException

前端 未结 4 1798
感情败类
感情败类 2020-12-06 13:44

I have this very big bug in my application that I really can\'t seem to solve. Whenever I make a rest call via the following code:

  HttpGet request = new H         


        
4条回答
  •  忘掉有多难
    2020-12-06 14:33

    Had a similar issue, could be reproduced only when trying to connect using several devices simultaneously and the solution was:

    Instance reboot solved problem with connections. (or just need to restart networking service)

    (c) My server/instance admin

    Also, there are people who experience similar issues and some other solutions worked for them, for instance:

    1. Disable tcp_timestamp
    2. Disable tcp_tw_reuse & tcp_tw_recycle
    3. Enabled vm save mode in Android manifest: android:vmSafeMode="true"

    • Android http connection - multiple devices cannot connect the same server
    • https://developer.appcelerator.com/question/182935/httpclient-behaviour-ok-on-3g-but-faces-timeout-under-wifi-for-2-or-more-devices
    • https://github.com/square/okhttp/issues/903
    • https://github.com/square/okhttp/issues/1037
    • https://github.com/square/okhttp/issues/1518

提交回复
热议问题