サーバーに(メソッドを介して)リクエストを送信するとすぐにNSURLConnection
sendSynchronousRequest
、サーバーは約2秒でそれを受信し、さらに3〜5秒で処理して応答を返します。ただし、30 ~ 35 秒でしか応答が返されません。この遅延により、通信が非常に遅くなります。
非同期 API でさえ応答が遅れています。
以前は、すべてが正常に機能しており、クライアントは 10 秒以内に応答を返していました。この問題を抱えている他の人はいますか?その理由は何ですか?
ここでの編集Wireshark
は、分析のスクリーンショットです。
より良い画像へのリンク
どのパケットが何を言っているのかを確認するにはどうすればよいですか?.そして、なぜ遅れているのですか?
EDIT2 コードは次のとおりです。
NSHTTPURLResponse *response=nil;
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:nsURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:180.0];
[theRequest setHTTPMethod:@"POST"];
[theRequest setTimeoutInterval:180.0];
[theRequest setHTTPBody:[[NSString stringWithFormat:@"%@",sdata] dataUsingEncoding:NSASCIIStringEncoding]];
NSError *error= nil;
NSData *result = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
if (error ) {
NSLog(@"error sending synchronous request: %@", error);
}
NSLog(@"request completed with code:%d",response.statusCode);