Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!hubcap!mikeoro From: mikeoro@hubcap.clemson.edu (Michael K O'Rourke) Newsgroups: comp.sys.mac.programmer Subject: ATP/Init Question - Part 2 Message-ID: <5927@hubcap.clemson.edu> Date: 6 Jul 89 12:46:10 GMT Organization: Clemson University, Clemson, SC Lines: 83 Well, I got a multitude of responses on my last question. All saying the same thing - remove the RememberA0() in the Receive function. Thank you for your help. I did remove the statement. However, it still crashes my machine. As I said before, the machine crashes a few seconds after the init is installed. I DON'T think the crash is called by the completion routine being called because there is NO way it the ATPGetRequest should complete. I haven't sent it any packets. If i have assigned the code to be locked and in the sysheap, is there some way the ATPPBptr is getting disposed of and crashing the machine? Any ideas on what might crash the machine, given the fact that the GetRequest should NOT have been completed? Any ideas of what might get it to complete prematurely, causing the Receive routine to get called (this might mean a bug in the Receive routine) ? For instance, when the system comes up, might it do something nasty like close the socket i just opened by re-initialzing AppleTalk? Michael O'Rourke Clemson University Once again, code follows: static ATPPBptr NewPBPtr; static Ptr NTE; static Byte Socket; static int RecBuff; Receive() { OSErr err; SetUpA4(); if (RecBuff == 666) SysError(1); else if (RecBuff == 999) ShutDwnPower(); NewPBPtr->atpSocket = Socket; NewPBPtr->reqLength = sizeof(RecBuff); NewPBPtr->reqPointer = (Ptr) &RecBuff; NewPBPtr->ioCompletion = &Receive; err = PGetRequest(NewPBPtr,1); RestoreA4(); } main() { MPPPBptr OldPBPtr; EntityName Entity; OSErr err; RememberA0(); SetUpA4(); err = ATPLoad(); if (err==noErr) { err = MPPOpen(); if (err==noErr) { NewPBPtr = (ATPPBptr) NewPtr(sizeof(ATPParamBlock)); OldPBPtr = (MPPPBptr) NewPtr(sizeof(MPPParamBlock)); NTE = NewPtr(120); NewPBPtr->addrBlock.aNet = 0; NewPBPtr->addrBlock.aNode = 0; NewPBPtr->addrBlock.aSocket = 0; NewPBPtr->atpSocket = 0; err = POpenATPSkt(NewPBPtr, 0); Socket = NewPBPtr->atpSocket; NBPSetNTE(NTE,"\pComputer", "\pLABdown", "\p*", Socket); OldPBPtr->MPPinterval = 2; OldPBPtr->MPPcount = 2; OldPBPtr->MPPentityPtr = NTE; err = PRegisterName(OldPBPtr,0); NewPBPtr->atpSocket = Socket; NewPBPtr->reqLength = sizeof(RecBuff); NewPBPtr->reqPointer = (Ptr) &RecBuff; NewPBPtr->ioCompletion = 0L/*&Receive*/; err = PGetRequest(NewPBPtr,1); DisposPtr(OldPBPtr); } } RestoreA4(); }