Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shogun!mike From: mike@shogun.cc.umich.edu (Michael Nowak) Newsgroups: comp.sys.mac.programmer Subject: Using the new AppleTalk interface from Lightspeed C 3.01 Message-ID: <894@mailrus.cc.umich.edu> Date: 29 Jan 89 17:03:25 GMT Sender: usenet@mailrus.cc.umich.edu Reply-To: mike@shogun.cc.umich.edu () Organization: University of Michigan Computing Center, Ann Arbor Lines: 54 UUCP-Path: mailrus!shogun!mike I originally posted this in comp.sys.mac... I'm trying to experiment with AppleTalk with my shiny new Lightspeed C compiler and I'm having trouble using the new "preferred interface" to AppleTalk listed in Volume V. Specifically, I'm trying to write some code to register an entity on the network, and then look for entities of that type. I can't get it to work - it usually crashes big time with a call to PLookupName(). Let me state specifically what I am doing, in hopes that someone will see the error of my ways. Here's what the call to PLookupName() looks like: search_name.objStr[0] = 0x01; search_name.objStr[1] = '='; search_name.typeStr[0] = 0x01; search_name.typeStr[1] = '='; search_name.zoneStr[0] = 0x01; search_name.zoneStr[1] = '*'; mpp_pb_ptr = (MPPPBptr)NewPtr(sizeof(MPPParamBlock)); if (mpp_pb_ptr == (MPPPBptr)0) { err_code = app_memoryErr; goto nomppptr; } mpp_pb_ptr->ioCompletion = (ProcPtr)0; mpp_pb_ptr->NBPentityPtr = (Ptr)&search_name; mpp_pb_ptr->NBPretBuffPtr = (Ptr)entity_buffer; mpp_pb_ptr->NBPretBuffSize = 1080; mpp_pb_ptr->NBPmaxToGet = 10; mpp_pb_ptr->NBPinterval = 8; mpp_pb_ptr->NBPcount = 3; err_code = PLookupName(mpp_pb_ptr, false); entity_buffer is defined as char entity_buffer[1080]. I originally tried using NBPSetEntity to set up search_name but have used this approach to cut down on places where I could mess up. The code crashes in the PLookupName call, with an odd address exception at 0x4345a0. Does anyone have any source code which might do such a thing that I can use as an example? Or if someone can point me to an ftp server which might have such an example, I'd appreciate that too. I looked at sumex but only found an example using the "alternate" or old interface. If you can send me mail, that'd be great. Any advice would be appreciated. ----------------------------------------------------------------------------- Michael Nowak ...mailrus!shogun!mike Workstation Consultant mike@shogun.cc.umich.edu U of M Computing Center User Services Mike_Nowak@um.cc.umich.edu ...working for but in no way representing the University of Michigan...