Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的 android 应用程序中建立一个持久的 http 连接。由于后端响应配置为Keep-Alive。
我想知道如何在 Android 中建立持久的 http 连接以避免每次握手请求。
设置标头以包含保持活动的请求。
HttpURLConnection conn = (HttpURLConnection) mURL.openConnection(); conn.setRequestProperty("Connection","Keep-Alive");