0

I am trying to adjust the timeout on a NSMutableURLRequest for a simple HTTP GET using setTimeoutSeconds:, but not having any luck. It seems to work for any values under 60.0, but if I set a larger value (ex: 90.0), then it still times out at one minute. I've tried setting it to 0.0 hoping it would have no timeout, but no luck there.

I have read many posts on this subject, some about POST issue which doesn't apply, but never seen a solid answer.

It seems to be a bug in iOS but I can't see anyway around it. I don't want to use ASIHTTPRequest, I need a workaround that I can use with NSMutableURLRequest.

Can anyone please help?

Locksleyu
  • 5,192
  • 8
  • 52
  • 77
  • What happens if you use a curl command to hit your server and specify a timeout of > 60 seconds? My guess is that maybe the server is killing the connection, as opposed to the client. You may also need to send a keep-alive header to the server. – Nicholas Hart Jul 26 '13 at 18:28
  • Its definitely not the server. I am using a custom server program that just accepts connections and then blocks forever. I have seen this behavior with other servers as well (really slow ones). – Locksleyu Jul 26 '13 at 18:29
  • I would try adding "Connection: Keep-Alive" to the headers and see if that helps. – Nicholas Hart Jul 26 '13 at 18:31
  • I just did and that had no effect. – Locksleyu Jul 26 '13 at 18:39
  • 2
    What are you doing that you need a timeout more than 1 minute? We may be able to offer other suggestions. – Marcus Adams Jul 26 '13 at 19:03
  • Its a long story but I have a very slow server which can result in a delay over than a minute. I need to be able to handle the case where it takes, say, 90 seconds. – Locksleyu Jul 29 '13 at 11:10

0 Answers0