Reputation: 6475
What is the connection time out in the case of iphones. How long will the compiler wait for a response after a request have been made??
Upvotes: 2
Views: 8197
Reputation: 277
The default request timeout is 60 seconds, but you can change it for any URLRequest. In this example, I set the timeout to 15 seconds on an NSMutableURLRequest by calling setTimeoutInterval:
NSURL *url = [[NSURL alloc] initWithString:@"http://someurl.com"];
NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];
[urlRequest setTimeoutInterval:15.0];
NSError *error;
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
Upvotes: 2
Reputation: 10701
Using NSURLConnection, the timeout is set in the NSURLRequest, and the default in the NSMutableURLRequest request is 60 seconds, and can be changed using the setTimeoutInterval method.
Upvotes: 4