Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-crg.llnl.gov!peirce From: peirce@lll-crg.llnl.gov (Michael Peirce) Newsgroups: comp.sys.mac Subject: AppleTalk programming question Message-ID: <1292@lll-lcc.aRpA> Date: Sat, 14-Nov-87 18:32:16 EST Article-I.D.: lll-lcc.1292 Posted: Sat Nov 14 18:32:16 1987 Date-Received: Sun, 15-Nov-87 20:18:47 EST Sender: usenet@lll-lcc.aRpA Reply-To: peirce@lll-crg.llnl.gov.UUCP (Michael Peirce) Lines: 77 ' I've been messing around with AppleTalk, or rather, trying to. I can get things to work: once. The first time I run the program things are fine and act as they should, but the second time BOMB! If anyone can suggest something, I'd really appreciate it. Below is a simple program that exhibits this behavior... -- michael ------------------------------------------------------------------------------- #include "stdio.h" #include "Appletalk.h" /* * LightSpeed C project contains the following libraries: * AppleTalk.lib * MacTraps * stdio * test.at.c * * You also need a resource file containing the 'atpl' resource found in * the file :LightSpeed C:Mac Libraries:Resource Files:ATalk/ABPackage * (this seems to contain the glue from Think for AppleTalk. * * * Run it once and it seems to work just fine, * but run it a second time and KAPLOWEE!!! * */ RetransType retrans = { 2, 2 }; EntityName who = { "\p=", "\p=", "\p*"}; ABRecHandle myABRec; OSErr stat; char buff[255]; main () { /* * Check to see if the drivers are open. */ printf("IsMMPOpen %d\n",IsMPPOpen()); printf("IsATPOpen %d\n",IsATPOpen()); /* * Open up the AppleTalk drivers (if already open, that's OK) */ stat = MPPOpen(); printf("stat from MPPOpen was %d\n",stat); /* * Ask the Name Binding Protocal who's out there... */ myABRec = (ABRecHandle)NewHandle(nbpSize); (**myABRec).nbpProto.nbpEntityPtr = &who; (**myABRec).nbpProto.nbpBufPtr = buff; (**myABRec).nbpProto.nbpBufSize = 255; (**myABRec).nbpProto.nbpDataField = 10; (**myABRec).nbpProto.nbpRetransmitInfo = retrans; stat = NBPLookup(myABRec,/* ASYNC => */FALSE); printf("stat from NBPLookUp was %d count = %d\n",stat,(**myABRec).nbpProto.nb pDataField); stat = MPPClose(); printf("stat from MPPClose was %d\n",stat); }