I want to use a single connection to communicate with a client device.
I am having problems keeping the connection alive. I'm using DefaultConnectionReuseStrategy() which returns false for keepAlive() after each request so the connection is always closed. I have set the Connection header to Keep-Alive but it still always closes the connection.
M开发者_开发百科y second problem is if I override keepAlive() to always return true, my client blocks while reading the input stream. How am I supposed to handle this? Should I be reading the content length header to find out how much to read? What if no content length is given?
精彩评论