I am having troubles while trying to implement NetLibSelect in my event
loop. The problem is that no matter what netFDIsSet always returns true for
the socket FD, even when there is no data to read. Below is my code...has
anyone else had troubles implementing NetLibSelect in the event loop?
Thanks in advance,
Alan
----------------------------------------
do {
// Check to see if we are posting
if (g_bBusy) // Global variable set when we are busy
sending/reading data
{
netFDZero(&readFDs);
netFDZero(&writeFDs);
netFDZero(&exceptFDs);
netFDSet(sysFileDescStdIn, &readFDs);
if (sock > 0)
netFDSet(sock, &readFDs);
int nWidth = sysFileDescStdIn;
if (sock > nWidth) nWidth = sock;
nNumFDs = NetLibSelect(AppNetRefnum, nWidth + 1, &readFDs,
&writeFDs, &exceptFDs, SysTicksPerSecond() / 5 , &err);
// Process any events
if (netFDIsSet(sock, &readFDs))
{
// Read data from socket
// I am always ending up here no matter what
}
}
EvtGetEvent(&event, 1);
if (! SysHandleEvent(&event))
if (! MenuHandleEvent(0, &event, &error))
if (! AppHandleEvent(&event))
FrmDispatchEvent(&event);
} while (event.eType != appStopEvent);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/