3

What is the maximum timeout interval I can use in my application. I m using following method.

(id)initWithURL:(NSURL *)URL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval;

I m using GET Method.

Thanks

Felix Christy
  • 2,179
  • 1
  • 19
  • 32
JiteshW
  • 2,195
  • 4
  • 32
  • 61

2 Answers2

3

NSTimeInterval data type is typedef of double data type, so the maximum time out value supported is the value that is maximum for double data type.

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
0

I think you should take into account that HTTP uses TCP. TCP connections are not controlled only by your application, there are also many routers and firewalls in between your application and the server.

I took a look into a typical firewall documentation just to see what is the default timeout for TCP connections.

For CISCO it is one hour.

http://www.cisco.com/c/en/us/td/docs/security/asa/asa91/configuration/firewall/asa_91_firewall_config/conns_connlimits.html#42354

So maybe you should consider this information when deciding on maximum connection timeout.

Also see section 5.5 here : https://www.rfc-editor.org/rfc/rfc6202 They claim that the best practice is 30 seconds.

Community
  • 1
  • 1
Dusan.czh
  • 669
  • 8
  • 15