Skip to content

Instantly share code, notes, and snippets.

@piaoapiao
Created September 20, 2012 01:16
Show Gist options
  • Save piaoapiao/3753408 to your computer and use it in GitHub Desktop.
Save piaoapiao/3753408 to your computer and use it in GitHub Desktop.
ASIHttpRequest Quene
quene = [[ASINetworkQueue alloc] init];
//quene.delegate = self;
ASIHTTPRequest *request =[[ASIHTTPRequest alloc] initWithURL:[[[NSURL alloc] initWithString:@"http://www.baidu.com"]autorelease]];
[request setQueue:quene];
request.delegate = self;
ASIHTTPRequest *request2 =[[ASIHTTPRequest alloc] initWithURL:[[[NSURL alloc] initWithString:@"http://www.google.com"]autorelease]];
request2.delegate = self;
[quene addOperation:request];
[quene addOperation:request2];
ASIHTTPRequest *request3 =[[ASIHTTPRequest alloc] initWithURL:[[[NSURL alloc] initWithString:@"http://www.yahoo.com/"]autorelease]];
request3.delegate = self;
[quene addOperation:request3];
ASIHTTPRequest *request4 =[[ASIHTTPRequest alloc] initWithURL:[[[NSURL alloc] initWithString:@"http://www.163.com/"]autorelease]];
request4.delegate = self;
[quene addOperation:request4];
ASIHTTPRequest *request5 =[[ASIHTTPRequest alloc] initWithURL:[[[NSURL alloc] initWithString:@"http://www.qq.com/"]autorelease]];
request5.delegate = self;
[quene addOperation:request5];
NSLog(@"finish:%d", [[[ASIHTTPRequest sharedQueue] operations] count]);
[quene go];
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSString *string = [request responseString];
// NSLog(@"cout:%d", [[[ASIHTTPRequest sharedQueue] operations] count]);
NSLog(@"queneNumber:%d", [[quene operations] count]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment