Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO behavior depends on server launch



As a related question, the documentation for NSConnection and NSMachPort
appear to imply that connections are specific to a *host* but I have not
been able to get my client and server apps to communicate unless they are
both running under the same Unix user id. Is this the expected behavior?

This is unfortunately a documentation issue. Every user "session" has a difference Mach namespace, and you can only use NSMachPort's within a single namespace. SSH creates a new "session", even if it's the same user as is logged in locally. I suspect you also have two different sessions for two different SSH connections, although I've never tested that scenario.


If you need more flexibility, your only option at present is to use sockets. Back in the NeXTStep days - I'm told; I ain't that old ;) - you could communicate using Mach between machines... I'm not sure how the namespaces figured into that, whether you didn't have them at all or there was a mechanism for inter-space communication, but in any case all that functionality has been stripped out of MacOS X (no, I don't know why either... I also don't know why in four major OS revisions Apple haven't fixed at least the documentation issues with DO, if not the implementation ones... but I rant...).

Performance of sockets shouldn't be too much less than mach ports - Unix domain sockets are the defacto way of doing IPC like this on non- Mach systems, so they're designed to be very fast. There are additional security issues though, since you can no longer be 100% sure you're only talking to the local machine... if you need that sort of assurance you'd need to do some extra checks (e.g. on each socket's remote address, etc).

Wade Tregaskis (AIM/iChat, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN, audio/video iChat & email: email@hidden, Jabber: email@hidden)
-- Sed quis custodiet ipsos custodes?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >DO behavior depends on server launch (From: Phill Kelley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.