site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com CFWriteStreamCopyProperty( stream, kCFStreamPropertySocketNativeHandle) and then call shutdown(2) on the fd you get back. See also: -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Jun 19, 2008, at 6:35 PM, Eli Bach wrote: How can I do an orderly vs a disorder TCP disconnect using CFWriteStream in my daemon? If I CFWriteStreamClose() immediately after my last CFWriteStreamWrite(), the data may or may not get sent out.
From the documentation, I gather that CFWriteStream buffers data internally before actually sending it down the wire, and I can query it if I can add data to the buffer, but there doesn't seem to be a way to query if that write buffer is empty, or to flush the buffer before closing the stream. I'm using CFRead/WriteStreams using events on a single runloop.
You do not give enough information about how you got it associated with the stream in the first place, but typically, you can do a: It may also do this automatically in the close, if you set the socket back to blocking, if you are using it non-blocking. Typically, a close flushes buffered output before returning. <http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/CFN...
which shows up in the first page of google results for "CFWriteStreamClose socket". This email sent to site_archiver@lists.apple.com