Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 [XCode] NSURLRequest timeoutInterval not as set?

views
     
TSTamamama
post Nov 2 2015, 04:20 PM, updated 11y ago

On my way
****
Senior Member
507 posts

Joined: Sep 2010


hi guys, I'm trying to implement a retry on http request timeout on my IOS apps, i've set the timeout interval as the code below

CODE
NSMutableURLRequest *urlRequest = [client requestWithMethod:@"POST" path:@"something.php" parameters:(NSDictionary *)parameters ];
   
[urlRequest setTimeoutInterval:10];


the problem is, i tested the interval by connecting my iPhone to a 3g hotspot, then turning off the 3g and initiate the curl request and here's the result that i logged

QUOTE
2015-11-02 15:47:25.368 sportsbetting[876:218887] failure to connect, connection count: 0 error:
2015-11-02 15:47:29.417 [876:218887] failure to connect, connection count: 1 error:
2015-11-02 15:47:33.466 [876:218887] failure to connect, connection count: 2 error:
2015-11-02 15:47:37.519 [876:218887] failure to connect, connection count: 3 error:
2015-11-02 15:47:41.568 [876:218887] failure to connect, connection count: 4 error:


as you can see from the log time, the interval between retries is 4-5 secs apart and not 10 secs.. although this is acceptable for me, i'd like to know, why and where is the 4-5 sec limit set, i've googled around and couldn't find an answer to this. is it default to the NSURLRequest class? do apple enforce 4-5 sec retries on no internet? why is it like that? help guys, any answer is appreciated.

This post has been edited by Tamamama: Nov 3 2015, 02:07 AM

 

Change to:
| Lo-Fi Version
0.0111sec    0.62    6 queries    GZIP Disabled
Time is now: 16th December 2025 - 11:15 AM