site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Thank you for answering. On May 31, 2010, at 12:21 AM, Pavel Hlavnicka wrote:
Hi Nava,
first I believe it's not the best idea to use timeouts to make you UI behaving nicely. You should rather invoke the request in a background thread and make UI working normally until it is processed.
I'm using NSURLConnection asynchronous call, so UI is working, the user has to wait for the data because it's a customer requirement, but the whole application is about presenting xml data in a table, so if user invoked downloading a certain xml, he wanted to see that data. My problem is that I cannot provide it because of the server.
On HTTP 1.1 requests you can set "Connection: close" header - though I do not believe it would help you as this would instruct the server to close the connection "after" the request is processed - you say that the request is still pending.
Yes, I tried that, it doesn't work :(
Next what you say sounds a bit suspicious - if the client side times out - I would expect it closes the connection and doe not use it for the next request - in any case it should not reuse the connection until it is still active. But this I'm just guessing (though it is educated guess).
NSURLConnection re-uses the http connection and it's a known problem, that's why I cannot reach other urls on the same server and asking for a help. Is there a way to tell the http header to interrupt the connection from the client side after a certain timeout? Thanks again
HTH
Pavel
On Sun, May 30, 2010 at 9:47 PM, Nava Carmon <ncarmon@me.com> wrote:
Hi,
I have an iphone application, that presents the data that comes as an xml files, which I fetch from a various urls on the same server. There are problematic urls, that when I try to reach them from safari or from within the application give an error - mostly timeout error.
When I initialize the NSURLConnection I define a timeout in my NSURLMutableRequest in order not to stuck the GUI and let the user to work with application. On timeout I get didFailWithError in NSURLConnectionDelegate and show a message that there was not response from the server and the user can continue working. The matter is that the connection or underlying socket somehow is preserved and the connection with the server is not closed. So when I try to get another url from the same server I can't reach it since the server is still stuck with the previous problematic request! Ffrom the other device or the browser I can reach urls, that are not reachable after problematic request on my device, simply because they open another socket to the same server. The question is how do I totally close (force closing) the problematic connection, that is stuck till the server will "get out" of this unsuccessful fetch? I tried close connection and cancel connection, but seems these APIs do nothing :(. I understand that NSURLConnection uses keep-alive value for connection in order to re-use the socket. How do I disable it? I'm using "GET" http method to retrieve the data.
Thanks in advance,
Nava Carmon ncarmon@mac.com
"Think good and it will be good!"
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/pavel.hlavnicka%40gmai...
This email sent to pavel.hlavnicka@gmail.com
-- Pavel Hlavnicka - think when printing save the trees be carbon neutral at least
Nava Carmon ncarmon@mac.com "Think good and it will be good!" _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com