• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Which API should I use for sockets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which API should I use for sockets


  • Subject: Re: Which API should I use for sockets
  • From: Becky Willrich <email@hidden>
  • Date: Mon, 16 Jun 2003 10:26:32 -0700

The difference is largely one of usage - CFStream (when created from sockets) is built on top of CFSocket and has the same performance characteristics. CFSocket is more general and can handle UDP and accept sockets; CFStream works well with TCP sockets where you want to view the data transfer as a stream. In other words - if your basic use model is open, read/write, and eventually close, CFStream will probably feel more natural and be more convenient. If that's not your basic use model, you probably need to use CFSocket.

CFStream also has some niceties built-in that CFSocket does not. It's trivially easy to add SSL encryption or apply a SOCKS proxy setting to a CFStream, but not with CFSocket. CFStream also handles the DNS host lookup asynchronously for you; CFSocket will not.

REW


On Saturday, June 14, 2003, at 10:36 AM, Doug Brown wrote:

Hi,

Just curious, but where does CFStream fit into all of this? What would be the advantages to using CFSocket instead of CFStream, and vice-versa? I've been looking at a few sample code snippets that use CFStream rather than CFSocket for making sockets and sending/receiving data, and I'm just curious what the difference is, and who/what each one is tailored to.

Thanks,

Doug

On Friday, June 13, 2003, at 12:34 PM, Becky Willrich wrote:

Take a look at /Developer/Examples/Networking/Echo and /Developer/Examples/Networking/Echo Client. These use a combination of CFSocket and CFSocketStreams (which just provide a stream API over the top of CFSocket).
_______________________________________________
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.
_______________________________________________
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: 
 >Re: Which API should I use for sockets (From: Doug Brown <email@hidden>)

  • Prev by Date: Re: NKE.pdf
  • Next by Date: Re: NKE.pdf
  • Previous by thread: Re: Which API should I use for sockets
  • Next by thread: Network Preference Panel And New Configurations
  • Index(es):
    • Date
    • Thread