NSURLConnection is run many times

前端 未结 4 689
刺人心
刺人心 2020-12-09 06:43

I connect asynchronously with server each 5 seconds. The URL is the same, but POST-body is changed each time. Now I create NSURL, NSURLRequest and NSURLConnection from the s

4条回答
  •  时光说笑
    2020-12-09 07:03

    Just to clarify things, NSURLConnection will reuse existing sockets, but only for a relatively small time frame (12 seconds). If you send a request, get back a response, and send a subsequent request within 12 seconds that 2nd request will got out on the same socket. Otherwise the socket will be closed by the client. A bug has been filed with Apple to increase this timer or to make it configurable.

提交回复
热议问题