[comp.sys.mac.programmer] Looking for AppleTalk name-checking code.

alexis@ccnysci.UUCP (Alexis Rosen) (05/03/89)

I've written some code which runs different pieces of itself on different
nodes on an AppleTalk net. The problem is, novice (read "careless and/or
stupid") users keep switching systems, and I wind up with machines with bad
node names.

Now I'm not worried about function A being performed on node B. If they're
not smart enough to figure that out, they won't mind it happening anyway.
The problem is running function A on node A, and node B, and node C.

I think a sufficient solution is to check, on bootup, if "my" node name is
already owned by another machine on the net. I don't have to worry about
zones.

I figure it's simple enough to do- a call or to to the NBP layer should do the
trick. I've never done this, though, so what I'd like is a small fragment
of code in either Pascal or C (or anything else, I guess) which does it.

Normally I'd just read & experiment, but I don't really want to muck around
on the AppleTalk net- it's always in use.

Thanks in advance,
---
Alexis Rosen
alexis@ccnysci.{uucp,bitnet}
alexis@rascal.ics.utexas.edu  (last resort)

cep@apple.com (Christopher Pettus) (05/04/89)

In article <1848@ccnysci.UUCP> alexis@ccnysci.UUCP (Alexis Rosen) writes:
> I think a sufficient solution is to check, on bootup, if "my" node name 
is
> already owned by another machine on the net. I don't have to worry about
> zones.

Remember that when you register a NBP name on the net using NBPRegister 
(IM II-299), it checks the network to make sure that the particular 
name:type@zone NBP tuple isn't registered somwhere else in some other 
note, and lets you know if it is.  Thus, if you managed to register the 
name successfully, you can be (reasonably) confident that your name is 
unique.  This is assuming that you are following the AppleTalk convention 
of using the user name entered in the Chooser as the "name", and an 
identifier unique to your application as the "type".

-- Christopher Pettus                   | "Brahma said: Well, after hearing
   Network Systems Development          | ten thousand explanations, a fool
   Apple Computer, Inc.                 | is no wiser.  But an intelligent
   cep@apple.com   {nsc, sun}!apple!cep | man needs only two thousand five
   AppleLink: PETTUS.C                  | hundred."  -- The Mahabharata