I'm using NetLibSelect to process commands from the socket connection and
also user events is the following way.  However, the timeout value for
NetLibSelect does not seem to be working.  When I'm not receiving any events
from the network or user events it's supposed to wait 6 seconds and then
wake up and send a nilEvent, after this has happened 10 times I want to do
some stuff. However it does not seem to wait at all but rather I just seem
to continually receive nilEvents with no respect to the timeout value.  I
know that this is the behavior on POSE because it doesn't work in the proper
way but even on the device it does not seem to be working but rather,
continually sending nilEvents rather than waiting 5 seconds.  Does anyone
have any ideas about why it doesn't seem to be working and how to get the
timeout to work?  I'm running it on a PalmVx connected to a server on
Windows 2000.

thanks,

Sally-Anne.

-----------------------------------------------------------------------
  FD_ZERO(&fds);
  FD_SET(sysFileDescStdIn, &fds);       // system events
  FD_SET(lSocket, &fds); // socket data available

  lSelectTimeout = SysTicksPerSecond()*6
  lMaxTimeouts = 10;
  lTimeouts = 0;

  Int16 lSelectResult = NetLibSelect(AppNetRefnum, lWidth, &fds, NULL,
                                     NULL, lSelectTimeout, &lError);
  if (lSelectResult < 0)
  {
   ErrorLog::reportPalmOsError(lError, "Select failed.");
  }
  else if (FD_ISSET(lSocket, &fds))
  {
   // process stuff from socket
   processSocket();
  }
  else
  {
   // process event from event queue
   EvtGetEvent(&lEvent, 1);
   if (lEvent.eType != nilEvent)
   {
    if (!preprocessEvent(&lEvent))
    {
     if (!SysHandleEvent(&lEvent))
     {
      if (!MenuHandleEvent(0, &lEvent, &lError))
      {
       if (!applicationHandleEvent(&lEvent))
       {
        FrmDispatchEvent(&lEvent);
       }
      }
     }
    }
   }
   else
   {
    // in idle time
    lTimeouts++;
    if (lTimeouts == lMaxTimeouts)
    {       
           // do some stuff
           lTimeouts = 0;
    }
   }
  }
 }

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

Reply via email to