You should probably check the result of NetLibSelect and/or "err"
before calling netFDIsSet. How do you know that an error or timeout
is not occurring?
-- Keith
At 5:46 PM -0700 6/5/01, Alan hand wrote:
>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/
--
-- Keith Rollin
-- Palm OS Emulator engineer
P.S. Check out the new e-mail address. [EMAIL PROTECTED] will work
for a while, but anyone mailing me needs to update to the new one
eventually.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/