I'm not sure how you define latency. Take a look at the wiki article for some clarification.
I would comment on the response time to get a picture of the network lag, very interesting in mobile connections. I use this approach in one of the applications that I developed:
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse { ... self.reqStart = [NSDate date]; self.url = [[request URL] absoluteString]; NSLog(@"--> Requesting : %@", url); ... } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)aResponse { NSLog(@"<-- Response time %fs : %@", [[NSDate date] timeIntervalSinceDate:reqStart], url); ... } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"<== Request time %fs : %@", [[NSDate date] timeIntervalSinceDate:reqStart], url); ... }
Bandwidth for simulator testing can be very useful.
source share