NetLibSelect() should work in a real device, however sysFileDescStdIn is not supported in the Palm Emulator.

Would you like to try to use macros and try again? For example,

netFDZero()
netFDSet()
netFDIsSet()
sysFileDescStdIn

You may also want to refer to the standard codes in the Palm OS Programmer's API reference.

Tony Cheung

RaNo wrote:
Hi!

See the code below. It's my eventloop with NetLibSelect blocking call.
I test the code on a real device connected via "mocha ppp" (like a real
modem).
(BTW. Is POSE NetLibSelect support at TCP/IP redirect correct with the most
recent versions of POSE?)

All seems to be OK, but data from the socket is not detected.
NetLibSelect always blocks until there is a UI event (eg. tap the screen).
So in order to get (rfds & (LG << RUN.sock)) there needs to be a UI event.
In other words - NetLibSelect blocks until there is a UI event, even though
the descriptor for the socket is set and there IS data to be read.

What do I do wrong? See my eventloop below:

void EL () {

//RUN.sock => socket, 0 if not connected
//RUN.n => NetLib reference

EventType e;
Err err;
NetFDSetType rfds, wfds, efds;
UInt32 LG= 1;

do {
rfds= 1; wfds= 0; efds= 0;
if (RUN.sock) {
 rfds |= (LG << RUN.sock);
 Int32 x= NetLibSelect (RUN.n, RUN.sock+ 1, &rfds, &wfds, &efds, -1, &err);
 if (err || x<1) {
  CN ("4"); //alert and close socket
  continue;
 }
 if (rfds & (LG << RUN.sock))
  GP (); //NetLibReceive...
}
if (rfds & LG) {
 EvtGetEvent (&e, -1);
 if (!SysHandleEvent (&e))
 if (!MenuHandleEvent (0, &e, &err))
 if (!AHE (&e)) FrmDispatchEvent (&e);
}
} while (e.eType!=appStopEvent);

}


--
Radoslaw Nowak, RNS::
www.ranosoft.com/palm




--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to