You can use non-blocking I/O and basically spend most of your time in
select(). select() will exit if there's an event waiting.
When you write your event loop with select() it won't look much different
than you propose. Just that you'll spend most of the time at the select()
call rather than the GetEvent() call.
LL
At 03:27 PM 9/15/99 -0700, B. Flaumenhaft wrote:
>Folks - I need to have my Palm application act as a server, listening for
>connections on a TCP port.
>
>(The short answer to "why?": the Palms are connected via a wireless
>network; an external agent needs to be able to send a message to my
>application which may occur at any time during the lifetime of the app.)
>
>The Palm isn't multithreaded, so the only way I can think to do this is to
>have my event loop, in addition to polling the event queue, poll the socket
>after calling listen() on it.
>
>Ideally, though, there'd be some way to make the NetLib send me socket
>request received events. I haven't seen a way to do this, and I'm assuming
>it's not possible.
>
>Anyone have any thoughts about this?
>
>Thanks,
>Ben Flaumenhaft
>
>