PDA

View Full Version : TimeOut for NSMutableURLRequest




amalshah71
Oct 27, 2009, 07:07 AM
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:40];


In the code above a URL Request is formed with a 'timeoutInterval' of 40 seconds

What i understand is 'timeoutInterval' would have it's effects in following cases:
1) When server is down
2) When server would take time > value set for 'timeoutInterval'
3) When there is no means of commnunicating with outside world (i.e. no GPRS/wifi connection availability)

Though only 1st point stands true

Why won't the 'request time out' would occur when there is no GPRS/wifi?

Or is it something else that i am missing?

amal



kainjow
Oct 29, 2009, 07:27 PM
I never found that timeout value to work that reliably. Instead I've used a standard timer to cancel the download manually, which worked perfectly.