Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!hp4nl!uvabick!gert From: gert@uvabick.UUCP (Gert Hulstein) Newsgroups: comp.sys.mac.programmer Subject: MacTCP Initialization Keywords: MacTCP Inititialize Message-ID: <1966@uvabick.UUCP> Date: 19 Jul 89 22:56:14 GMT Sender: news@uvabick.UUCP Organization: uvabick Lines: 75 I just started playing with MacTCP and found that the first call to PBOpen for the ".ipp" driver takes a long time (>30 secs) with lots of Disk access. This hapens every time After the machine is restarted. Anybody know what it's doing, and how to avoid it ? Gert Hulstein, University of Amsterdam. gert@uvabick.uucp Below a MPW Code segment that I used : #include #include #include "MacTCPCommonTypes.h" #include "TCPPB.h" #include "AddressXlation.h" #include "GetMyIPAddr.h" short gIPPDriverRefNum; OSErr _TCPInit() { auto ParamBlockRec pb; auto OSErr osErr; pb.ioParam.ioCompletion = 0; pb.ioParam.ioNamePtr = "\p.ipp"; pb.ioParam.ioPermssn = fsCurPerm; osErr = PBOpen( &pb, false ); if ( noErr == osErr ) { gIPPDriverRefNum = pb.ioParam.ioRefNum; } return osErr; } OSErr _TCPGetIP(pb, ip, netMask, ioCompletion, async) struct IPParamBlock *pb; ip_addr *ip; long *netMask; ProcPtr ioCompletion; Boolean async; { auto OSErr osErr; pb->ioCompletion = ioCompletion; pb->ioCRefNum = gIPPDriverRefNum; pb->csCode = ipctlGetAddr; osErr = PBControl((ParmBlkPtr) pb, async); if (!async && (noErr == osErr)) { *ip = pb->ourAddress; *netMask = pb->ourNetMask; } return osErr; } main() { struct IPParamBlock myPB; ip_addr myIP; long myNetMask; if ( _TCPInit() == noErr ) { if ( _TCPGetIP( &myPB, &myIP, &myNetMask, 0, false ) == noErr ) { printf( "addr = %lo\n", myIP ); } else printf( "YikesI\n" ); } else printf( "WhoopsI\n" ); }