I have a small bug in my client app that uses NSURLConnection. I have tracked it down to an unexpected connection keep-alive that seems to confuse the web server (probably a bug on the server side). The workaround would be to force-close all outstanding connections at a certain point. Can I do this somehow with NSURLConnection, i.e. something like
[NSURLConnection closeAllIdleConnections];
The keep alive timeout on the Message Processor allows a single TCP connection to send and receive multiple HTTP requests/responses from/to the backend server, instead of opening a new connection for every request/response pair.
Enabling Keep-Alive is a great way to optimize your website as it helps improve speed and performance, ensuring faster load times and higher efficiency. By turning the Keep-Alive header on, the client and server can reuse a single TCP connection for a number of requests and responses.
The Client Keep-Alive mode enables the Citrix ADC appliance to process multiple requests and responses using the same socket connection. The feature keeps the connection between the client and the appliance (client-side connection) open even after the server closes the connection with the appliance.
ASIHTTPRequest has an expirePersistentConnections method. It may do what you're looking for.
It's not a drop-in replacement for NSURLConnection, but it's not too hard to port code from NSURLConnection to ASIHTTPRequest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With