connectionWithRequest:delegate: May Not Open if Cancelled?
connectionWithRequest:delegate: May Not Open if Cancelled?
- Subject: connectionWithRequest:delegate: May Not Open if Cancelled?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 25 Apr 2006 16:22:42 -0700
- Thread-topic: connectionWithRequest:delegate: May Not Open if Cancelled?
After it has received requested data, my app sends an acknowledgement HTTP
message back to a server using an NSURLConnection with method "POST". My
app is not interested in any response the server may give.
I feel it is a good practice in this case to immediately cancel the
connection:
NSURLConnection* ackConnection = [NSURLConnection
connectionWithRequest:request delegate:self] ;
[ackConnection cancel] ;
However, occasionally the server does not receive the ack, as though the
connection gets cancelled before it gets sent, not what was intended. (The
method used there is asynchronous.) If I remove the -cancel message, then
the server always gets the ack.
Since it only fails occasionally, it would take a lot of experiments to
confirm the correlation, which I have not done. Does anyone agree that this
might happen? I don't see anything in the documentation one way or the
other.
For now, I have removed the message -cancel because, in this particular
case, the delegate is retained by NSApp and is therefore not going away.
Jerry Krinock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden