My guess is that you are not checking hostInfo for NULL before using it.  If
the call to NetLibGetHostByName fails, hostInfo will be NULL.

Sohil Shah wrote:

> My Palm OS 5 Simulator throws an Invalid read from 000000C error.
> 
> The error occurs during the
> hostInfo = NetLibGetHostByName(netLib,
> host,hostInfoBuffer,timeout,&netLibErr);
> 
> method call. The code works 2 or 3 times just fine. BUt then this error
> pops up. It works again a couple of times after Reset and then the error
> pops up again.
> 
> Here is the NetLib code that is being executed
> 
> //load an instance of the net library
> netLibErr = SysLibFind("Net.lib",&netLib);
> 
> //open the instance of the net library before using
> //it for network related activities
> netLibErr = NetLibOpen(netLib,&netLibOpenErr);
> 
> //calculate the IP address of a hostname
> hostInfoBuffer = (NetHostInfoBufPtr)
> MemPtrNew(sizeof(NetHostInfoBufType));
> 
> //this method throws an internal err out of the blue
> //on the simulator
> hostInfo = NetLibGetHostByName(netLib,
> host,hostInfoBuffer,timeout,&netLibErr);
> 
> 
> addr = (NetIPAddr*)hostInfo->addrListP[0];
> ip = *addr;
> MemPtrFree(hostInfoBuffer);
> 
> Do I need to change any options on my compiler etc. Help with this issue
> will be greatly appreciated.
> 
> Thanks
> Sohil


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to