Re: POSIX sockets and event loops
Re: POSIX sockets and event loops
- Subject: Re: POSIX sockets and event loops
- From: Douglas Davidson <email@hidden>
- Date: Thu, 20 May 2004 19:00:34 -0700
On May 20, 2004, at 6:00 PM, Aaron Ballman wrote:
So let me see if I have the concept down. I would want to take the BSD
socket descriptor I make and pass it into a call to
CFSocketCreateWithNative. The options I would want to pass in for the
callback type are kCFSocketWriteCallBack and kCFSocketReadCallBack.
After
creating the CFSocket, I would then make a run loop with
CFSocketCreateRunLoopSource and add it with CFRunLoopAddSource.
You create a run loop source and add it to the current run loop, as you
describe. You can then release the CFSocket and the run loop source;
the run loop will hang on to them. When you are finished, simply
invalidate the CFSocket. You can arrange for this to close the socket
or not, whichever you wish.
Then, in the callback I specify, I can just use my regular socket
descriptor
to do the reading and the writing?
Just so.
Douglas Davidson
_______________________________________________
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.