Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Event driven CFStream protocol in 10.1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Event driven CFStream protocol in 10.1?



I have been fiddling a lot with using
CFSocketCreateConnectedToSocketSignature and from the connect callback
creating read/write stream pairs with client callbacks scheduled in my run
loop. The socket appears to connect and stay open but the stream callbacks
are never called. I just want to know if this is supposed to work on 10.1 (I
am on 10.1.4). If it turns out that this is indeed the case, I would
appreciate some hints about what I could be doing wrong and will post the
code somewhere so it may be analyzed. Thanks in advance for any help! :)

It's supposed to work; the catch is that the stream needs to own the CFSocket (there's exactly one CFSocket per open file descriptor), but you created the CFSocket using CFSocketCreateConnectedToSocketSignature(), so the CFSocket carries your callback instead of the CFStream's internal one.....

You need to either use CFStream or CFSocket, but not both; either approach is quite do-able. To use CFSocket, just add the ReadCallBack to your callbackTypes and change your callback to look for that event - when the event comes in, there's data waiting to be read on the socket. To use CFStream, just don't create the CFSocket. :)

REW
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Event driven CFStream protocol in 10.1? (From: Kris Amico <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.