On 26-Jul-99 Andre Sant'Anna wrote:

> Oops!  I meant to say "NetLibSelect" throughout the
> my previous post! See below ...
> 
> -----Original Message-----
> 
> I am trying to use "NetLibSelect" to wait on
> a listening socket until there is a connection that
> can be accepted.  Although this is legal usage, it
> does not seem to work.
> 
> The behavior I see is that NetLibSelect returns
> immediately and claiming there is a connection pending
> even if there isn't one ...
> 
> Is this broken/not supported in the Palm OS? Anybody out
> there run into this?

Take a look at Jim Rees' httpd code or if you have it, CW comes with an ftp
server that does a lot of that stuff.  However, httpd uses a lot of blocking
stuff, and in fact it just sits on a blocking accept() IIRC.  But it may help
you find a problem in your code if you look at the other stuff he does.

http://www.citi.umich.edu/u/rees/pilot/

If you are using NetLibSelect() to wait for a connection request then IIRC
it will appear as a read, so just do something like this:

netFDZero(&rfds);
netFDZero(&wfds);
netFDSet(sysFileDescStdIn, &rfds); /* if you want system events */
netFDSet(listensocket, &rfds);
rv = NetLibSelect(AppNetRefnum, netFDSetSize, &rfds, &wfds, NULL,
         to, &errno);
if (rv > 0) {
    if (netFDIsSet(listensocket, &rfds)) {
        /* accept the connection into another socket */
    }
}


/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */

Reply via email to