开发者

Handling multiple requests over a single connection using httpcomponents?

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜