Note that there are some explanatory texts on larger screens.

plurals
  1. POios NSURLConnectionDataDelegate didReceiveData callback not called
    text
    copied!<p>I have a problem. I have read a lot of topics on stackoverflow about this problem but nothing helped. I am trying to implement client-server communication via comet connection. I have an instance which is responsible for sending messges and instance which is responsible for receiving messages. The process is the following: - Send instance sends GET request to server, server responds to the receive instance. The first call works fine, I get the first response and can get the data I need but next request do not make my didReceiveData callback to trigger. But I see that the server has sent data, I see it in the server logs and I see it in wireshark at client machine. An interesting thing: the first response hadn't been making my callback to trigger before I added "content-length: 0" to response. Undocumented feature of NSUrlConnection? What else should I consider to make NSUrlConnection think the response is valid? Alternative: force to fetch data from socket, but I don't know if it possible with NSUrlConnection (man is mute about it)</p> <p>persistent connection code:</p> <pre><code> NSURL* requestUrl = [NSURL URLWithString:[[NSString alloc] initWithUTF8String:rq-&gt;url.c_str()]]; NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:requestUrl cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:600]; m-&gt;connection = [[NSURLConnection alloc] initWithRequest:request delegate:request_delegate() startImmediately:NO]; [m-&gt;connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; [m-&gt;connection start]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload