Re: Which API should I use for sockets
Re: Which API should I use for sockets
- Subject: Re: Which API should I use for sockets
- From: Douglas Davidson <email@hidden>
- Date: Fri, 13 Jun 2003 11:14:58 -0700
On Friday, June 13, 2003, at 10:37 AM, Kirk Haderlie wrote:
I am beginning a new project that will use TCP sockets. I am new to
OS X
development and would like some opinions on which API we should use.
(CFSockets, NSSockets, or BSD Sockets) If there is any documentation
on
Apple's Site that answers this question please direct me there.
Which API you should use depends a great deal on what you intend to do.
If you want to write cross-platform code, and are comfortable working
with BSD sockets, including potentially using multiple threads to avoid
having everything block on networking, then you can certainly use BSD
sockets directly. If your code is intended to be Mac OS X-specific, or
if you wish to use other system facilities (such as CFRunLoop sources,
Carbon events, or Cocoa), and you wish direct control over your
sockets, then CFSocket may be appropriate--it provides a simple wrapper
around BSD sockets that allows them to serve as run loop sources. If
you want a higher-level stream abstraction, then it would probably be
more convenient to use the facilities of CFNetwork, which are built on
top of CFSocket.
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.