On 08-May-2000 Rhys Arkins wrote:

> I've had some experience writing normal tcp client/server under unix but am
> just starting out writing networking code on the palm. I am confused as to
> where I can put my code in the event loops so as to still provide GUI
> interactivity to the user.

It's actually pretty simple.  In a normal palmos event loop you will block on
EvtGetEvent() until something happens.  However if you have open sockets you
need to watch you can choose to block on NetLibSelect(), just be sure to
netFDSet(sysFileDescStdIn, &rfds) because palmos will use sysFileDescStdIn to
indicate that an event is pending.  You'll still use EvtGetEvent() afterwards
to retrieve the event, however you won't want to block so set the timeout to
0.

> For instance, in the single threaded, event-driven Palm environment, how can
> I set it to poll/select a socket every X milliseconds, then display any data
> which arrives, while still allowing the user to enter and send their own
> data? Currently my Palm client connects to a simple server and can send data
> to it whenever the user types text and clicks a "send" button, however I am
> confused as to how to structure the code to allow a two-way communication
> (e.g. for a chat kind of program). Any help greatly appreciated!

No problem to do that.  Here's a convoluted example in GGM.  Wish I could
give you a simpler program but unfortunately I can't release the one that
would be clearer.

http://rallypilot.sourceforge.net


/* Chris Faherty <[EMAIL PROTECTED]>                 */
/* Your Stock has crashed - you must now restart your system */


-- 
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