I have found that the most reliable way to get NetLibReceive to work on the simulator
is to first do a NetLibSelect and then only do a NetLibReceive if the select call
indicates that data is ready to be read. Once I discovered this trick my programs
have no trouble running on the simulator. However before I found this trick I was
very frustrated with the simulator and avoided it whenever I could.
Example code:
netFDZero(&readFDs);
netFDZero(&writeFDs);
netFDZero(&exceptFDs);
netFDSet(pt->socket,&readFDs);
width = socket;
addrLen = 0;
if(NetLibSelect(sNetLibRefNum,
width,&readFDs,&writeFDs,&exceptFDs,0,&err) <= 0)
return false; // nothing to read
i = NetLibReceive(sNetLibRefNum,
socket,s,256,0,NULL,&addrLen,0,&err);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/