Timeout in NSMutableURLRequest not honored?
Timeout in NSMutableURLRequest not honored?
- Subject: Timeout in NSMutableURLRequest not honored?
- From: Tito Ciuro <email@hidden>
- Date: Tue, 5 Jul 2005 18:40:50 -0400
Hello,
Even though I set the timeout to 10 seconds, the following call hangs
forever when the URL is invalid:
- (NSXMLDocument*)xmlDocument
{
if (!xmlDocument) {
NSMutableURLRequest *request = [[[NSMutableURLRequest
alloc] initWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:
10.0] autorelease];
[request setHTTPMethod:@"GET"];
MyURLConnection *conn = [[[MyURLConnection alloc]
initWithRequest:request delegate:self] autorelease];
while (![conn isFinished])
[[NSRunLoop currentRunLoop]
runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
NSError *error = nil;
xmlDocument = [[NSXMLDocument alloc] initWithData:[conn
data] options:NSXMLNodeOptionsNone error:&error];
}
return [[xmlDocument copy]autorelease];
}
Any ideas?
Thanks,
-- Tito
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden