Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!claris!outpost.UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: AppleTalk & Think C -- Help sought Message-ID: <0B010004.ypwqau@outpost.UUCP> Date: 23 Jan 91 05:13:24 GMT Reply-To: peirce@outpost.UUCP Organization: Peirce Software Lines: 36 X-Mailer: uAccess - Mac Release: 1.0.3 In article <2245.279c7e47@spacm1.spac.spc.com>, audit038@spacm1.spac.spc.com writes: > > HELP!!! The following Think C code is my attempt at registering a name > on AppleTalk. This either blows up or registers garbage. I'm new to the MAC > and I was wondering if someone could point out where I'm blowing it. You're using the old call, NBPRegister. The "preferred" interface (i.e. the interface Apple recommends you use now) is PRegisterName. See Inside Macintosh Volume V, Chapter 28 for *some* info on this. Not only are you using the old call, you are doing so asynchronously which means it would try to post a completion event or some such nonsense when it's done. Your code checks status right away, then claims success without waiting for the real completion of the routine. Here's a fragment of code for using PRegisterName (sorry about the Pascal, but it should be easy to transliterate...): 1: NBPSetNTE(@theElementBuff,theName,theType,'*',theSocket); 2: WITH theMPPPB DO BEGIN 3: entityPtr := @theElementBuffer; 4: interval := 3; 5: count := 2; 6: verifyFlag := $FF; 7: END; 8: CheckStatus(PRegisterName(@theMPPPB,kSYNC)); Note that entityPtr really points to a name table entry in this case and the memory it points to can't move until after the name is unregistered. -- michael -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE