Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!claris!UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: AT Socket Installation Message-ID: <0B01FFFB.gfcae0@outpost.UUCP> Date: 24 May 91 17:06:12 GMT Reply-To: peirce@outpost.UUCP (Michael Peirce) Organization: Peirce Software Lines: 83 X-Mailer: uAccess - Mac Release: 1.1.b3 In article <1991May23.130616.10046@bernina.ethz.ch>, queloz@bernina.ethz.ch (Ronald Queloz) writes: > I want to see how a piece of software (CDEV/INIT) I wrote spreads in > on our AppleTalk network. I thought I could install an AppleTalk > socket (with name and type) at initialization time (INIT). Then I > could use a network utility like InterPoll to see where my software > has been gone to. > > Now my question: Is there a simple way to install a AT socket which > does no communication at all. What Routine do I have to pick, what are > the parameters? Here's some general code you could adapt. Note that the DataBlockP is a pointer to a record allocated in the system heap. It must be on the system heap since the NBP name buffer must not move while the name is registered (forever in your case). ALL permanent storage is part of this data record. PROCEDURE GoOnline; VAR nameCount : integer; theNBPType : str255; countStr : str255; BEGIN {GoOnline} WITH DataBlockP^ DO BEGIN WITH theATPPB DO BEGIN atpsocket := 0; {ask for any available} addrBlock.aNet := 0; addrBlock.aNode := 0; addrBlock.aSocket := 0; END; IF POpenATPSkt(@theATPPB,kSYNC) <> noErr THEN DebugStr('POpenATPSkt'); mySocket := theATPPB.atpSocket; userName := GetString(-16096); theNBPType := GetString(-4096)^^; serverName := userName^^; nameCount := 1; REPEAT NBPSetNTE(@entityBuff,serverName, theNBPType,'*',mySocket); WITH theMPPPB DO BEGIN EntityPtr := @entityBuff; Interval := 3; count := 3; verifyFlag := $FF; END; stat := PRegisterName(@theMPPPB,kSYNC); IF stat = nbpDuplicate THEN BEGIN nameCount := nameCount + 1; HLock(Handle(userName)); NumToString(nameCount,countStr); serverName := concat(userName^^, ' [',countStr,']'); HUnlock(Handle(userName)); END; UNTIL stat <> nbpDuplicate; IF stat <> noErr THEN BEGIN DebugStr('PRegisterName'); END; { %%% Skip this part since you don't want to read, of course you could hang a read here and respond with version information... } WITH inATPPB.realATPPB DO BEGIN atpSocket := mySocket; reqLength := SIZEOF(PacketRec); reqPointer := @inPacket; numOfBuffs := 1; ioCompletion := codeH^; END; inATPPB.dataPtr := LongInt(DataBlockP); IF PGetRequest(@inATPPB.realATPPB,kASYNC) <> noErr THEN DebugStr('PGetRequest'); END; END; {GoOnline} -- 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