It sounds to me like you are looking for the Select call. Select lets
 you block until an event occurs. The event can be a UI event or a network
event. The basic idea is that you set up select so that either type of
event will
wake you up. If you get a UI event, call EvtGetEvent and handle it. If you
get a
network event, call netLibSocketAccept to respond to the request. If you
really need
to periodically update something, you can still set a timeout, but do not
set it too
short or you will drain the batteries by causing the processor to work
overtime.

netFDZero(&readFDs);
netFDZero(&writeFDs);
netFDZero(&exceptFDs);
netFDSet(sysFileDescStdIn, &readFDs);
netFDSet(mySocket, &readFDs);
maxRefnum = mySocket;
numFDs = NetLibSelect(netLibRefNum, maxRefnum+1,&readFDs, &writeFDs,
&exceptFDs, timeout, &err);
if (numFDs==0)
     // timeout occured
else
{
     if (netFDIsSet(mySocket,&readFDs))
          // you know the socket has data so do accept here

     if (netFDIsSet(sysFileDescStdIn,&readFDs)
          EvtGetEvent(eventP,timeout);  // a UI event is available,so get
it...
}

That's the basic idea - check out the docs for more info on Select...

--  Gavin Peacock
Palm Computing

>Date: 16 Mar 1999 17:28:48 -0800
>From: Gavin Maxwell <[EMAIL PROTECTED]>
>Subject: NetLibSocketAccept
>Hi all,
>The NetLibSocketAccept call blocks until either it receives a connection
>or it times out. What I'd like to know is can I do all the setup (bind,
>listen etc) then call NetLibSocketAccept with a small timeout
>(sub-second) to check if a connection has arrived, and keep checking
>every so often... or do connections get rejected if there isn't an
>outstanding Accept? The docs ain't very clear, and I don't have any
>standard sockets docs in front of me...
>Thanks,
>Gavin.


Reply via email to