gpt4 book ai didi

android - 在 HttpURLConnection 中停止静默重试

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:15:40 24 4
gpt4 key购买 nike

我在 Android KitKat 上使用 HttpURLConnection 将一些数据发布到服务器。服务器需要很长时间才能响应,连接在超时前静默重试 1 到 3 次。我不希望它重试,因为服务器会处理所有请求,从而导致 Bad Things(TM)。

我在打开连接之前尝试了 System.setProperty("http.keepAlive", "false"),但这没有帮助。

最佳答案

对于 POST 调用集

httpURLConnection.setChunkedStreamingMode(0);

这应该可以解决静默重试问题。可以找到错误报告和解决方法 here .

关于android - 在 HttpURLConnection 中停止静默重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24417817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com