Yes, you need to give time to the system for irda comms to work reliably.
You can code up a nested event loop - something like:
IrDiscoverReq(..);
Word timeout = TimGetTicks()+SysTicksPerSecond(); // one second timeout
for (;;) {
EvtGetEvent(&event, SysTicksPerSecond());
// In your irda callback you'd need to set a global if you connect, so you'll know it
worked or not here
// Also, you may get other events, which you'll need to decide to process or not
if (TimGetTicks() > timeout) break;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/