Unexpected -readClosedForStreamTask: when remote socket closed
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=rTQVXLWnaJBP7OXzmEXKcWnyNcqel 5se/VONQ4uNZlg=; b=FmO3Ps+oErAE0/sn3cFo7dvdr53b4o5Y5OP9qPdZPr5mB 7BQOccVNmDrpoccSU7vbg5jzalWpqdXAXaNI45bboBsSp2K0FawLBbkt47xpFsDy AoTq2r2m+tvYDnv6Vvzgwxjovjf0IbuiA+UCuwGCHT3j4irjqRAfQic4b1wIhHJA owCsmb4lHhzertjKxnh3kQnDUCT420ddE/JJEnANlKfqmELcgTTHZVGBLafaiQqS C8sD58DMYVtYcoeOTmscVN4Fsv4R/rBxwil3gro/qxV4lhNKtnKIml1kSsfVR+dy LnbEG0J2Y4FxmvcS/vElKceN2eXvC7E2ZVw/EFz2Q== Another issue involving our usage of NSURLSessionStreamTask for a TCP client connection. QE observes that, if the remote TCP server process is killed, the -didCompleteWithError: delegate method is not called; instead readClosedForStreamTask: is called. Since I’ve been unsure what the latter method is for, my implementation just logs a message and does nothing. The end result is that the app thinks the connection is still open even though it isn’t. The docs for the method (below) seem to imply the socket is in a “half-open” state, which seems incorrect in this case because the remote socket was closed completely by the kernel on process exit. In any case, what should I do in response to -readClosedForStreamTask:? Should I call -readDataOfMinLength:…? Should I then wait for -didCompleteWithError: to be called, or does it not get called at all in this situation? /* Indiciates that the read side of a connection has been closed. Any * outstanding reads complete, but future reads will immediately fail. * This may be sent even when no reads are in progress. However, when * this delegate message is received, there may still be bytes * available. You only know that no more bytes are available when you * are able to read until EOF. */ - (void)URLSession:(NSURLSession *)session readClosedForStreamTask:(NSURLSessionStreamTask *)streamTask; —Jens _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jens Alfke