I'm working on an Android application that requires very quick responses from our server. We communicate using HttpURLConnections. In an attempt to reduce latency, I'd like to "warm up" the connection by opening the socket when the user is actively using the application so that when we do get a request to send data, the connection will already be established (assuming the socket wasn't closed server side due to timeout). I believe that URL.openConnection() does not actually open this socket (despite its name) until data is actually sent. Is this correct? If so, is there a better way to simply open a socket and pass that to another HTTPURLConnection later without sending data and have that socket stay open for the keep-alive time?
以上就是How to open a socket in anticipation of an ensuing HttpURLConnection的详细内容，更多请关注web前端其它相关文章！