HTTP Post - Time Out - 在超时间隔内启动多个请求

Sub*_*ubi 9 post http ios

我正在使用HTTP Post方法并启动同步请求.[NSURLConnection sendSynchronousRequest:..]

对于HTTP POST请求,默认超时发生在75秒,如许多线程中所讨论的.

但是在75秒的超时期间,我们会针对所有相同参数提出的相同请求启动多个Web服务请求.

请告诉我们导致多个请求启动的原因是什么?这是由于HTTP POST一般还是由于同步请求?

@iOS示例代码

[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
[request addValue:[NSString stringWithFormat:@"%d", body.length] forHTTPHeaderField: @"Content-Length"];

 [[NSURLCache sharedURLCache] setDiskCapacity:0];
 [[NSURLCache sharedURLCache] setMemoryCapacity:0];

 NSURLResponse *response;
 response = nil;

 urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];              
 if(urlData)
 {
        NSString *responseString = [[NSString alloc] initWithData:urlData encoding:NSASCIIStringEncoding];
        [self parseStringInformation:responseString infoDict:informationDictionary];
        //NSLog(@"%@",responseString);
 }
Run Code Online (Sandbox Code Playgroud)

Lou*_*cci 1

如果没有服务器的请求响应日志,则有多种可能性。

程序员错误:您是否已经经历过所有“gotchya”类型的情况?

Web 服务器响应:如果没有 Web 服务器日志(或您发布到的服务的代码),很难说......

API 错误:您发现一些极端情况会导致不必要的副作用。也许苹果有错误跟踪器或开发人员支持论坛?