Re: Socket and Objective-C
Re: Socket and Objective-C
- Subject: Re: Socket and Objective-C
- From: Greg Titus <email@hidden>
- Date: Mon, 10 Sep 2001 16:58:35 -0700
On Monday, September 10, 2001, at 02:20 PM, John Pannell wrote:
Hope some of this helps - I would enjoy any comments on the
performance/bugginess/difficulty of the various socket options from
people who have used them... specifically
options: OnmiNetworking, smallsockets, CFSocket, NSFileHandle/BSD,
EDInternet
which of these operate asynchronously like NSFileHandle (i.e.
readInBackgroundAndNotify:)?
Does CFSocket really have bugs? If so, what?
Any comments/comparisons between these options?
Hi John,
Just a quick answer to one of your questions: OmniNetworking does have
API for setting up non-blocking sockets, but the framework is primarily
intended to be used synchronously (and in multiple threads). If your
needs are very simple, going multi-threaded is probably overkill and
using synchronous sockets in a single-threaded app usually leads to a
poor user experience, so you should go with one of the other solutions.
On the other hand, OmniNetworking does provide a nice stream API
(ONSocketStream) which does its own buffering and provides methods for
doing things like reading a line at a time, which can be very useful
when you are talking a standard Internet protocol like HTTP/FTP/NNTP/RFC
822, et cetera. If you do decide to go multi-threaded, OmniFoundation
provides some great primitives for main thread notification. (I.e. you
can just call [myObject
mainThreadPerformSelector:@selector(notifyOrWhatever)]).
Scott Anguish wrote some good OmniNetworking sample code for speaking
NNTP in a Stepwise article a little over 3 years ago
<
http://www.stepwise.com/Articles/Technical/OmniNetworking.html>. The
API is the same still, and we've barely had to touch the framework in
the intervening years. It's quite stable and bug free.
Sorry I don't have any comparisons with the other options you mention...
--Greg