On Dec 5, 2008, at 10:21 AM, Kirk Kerekes wrote:

My core point (which seems to have gotten lost in this thread) is that the Apple docs _used_ to assert that NSSocketPort was useless for anything except DO.

1. This _may_ not ever have been true. Just from looking at the API, it is patent that NSSocketPort was always _intended_ to be a thin wrapper around a BSD socket.

2. The docs no longer make the "only for DO" assertion. Instead they assert that NSSocketPort _is_ a wrapper around a BSD Socket, and that it is generally useful.

3. NSSocketPort _does_appear_to_work_fine_ as a wrapper around a BSD socket, once you disregard the lingering myths (and previous docs) and start taking the current docs at face value.

I have never attempted to assert that NSSocketPort was somehow a one- size-fits-all solution to network communication, or that one could implement a complete network I/O functionality without using any other classes.

Having a wrapper around BSD sockets is handy, particularly if the task is to communicate with another socket-based app, regardless of platform.

NSSocketPort is not a general-purpose BSD socket wrapper. It is a subclass of NSPort, that is implemented using BSD sockets for its transport mechanism. You can use it for the purposes that NSPorts are generally used for, i.e., communicating with another similar NSPort, but the primary purpose of NSPorts is to serve as transport for DO. For a general-purpose BSD socket wrapper, look at CFSocket at the lowest level, or the various CFNetwork facilities at a somewhat higher level. If you're communicating with a server you don't control, that doesn't itself use Cocoa, then you want general-purpose network communication facilities such as CFSocket or CFNetwork, not an NSPort subclass. It is possible to create an NSSocketPort, then extract the socket and use it separately, but that isn't really using an NSSocketPort.

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to