Select does not support stdin on the emulator, I have had no trouble with it
on the actual device (symbol 1740)
-----Original Message-----
From: Ariel Barreiro [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 05, 2000 13:46
To: Palm Forum List
Subject: NetSelect
Dear all,
I know that recently somebody asked a bout netselect but I read the messages
and I couldnt get the idea.
I have a read and write functions that performs some stuff inside the net
layer.The problem is that I dont handle the data reception as an event. I
just entered in a loop while I wait for the data to get into the palm. Now
if the data lasts 2 or 3 minutes (that are time that might last and are
under my timeout) the palm stay hanged until the data is ready. Now I tried
to implement a select as I implemented for the conduit (which has the same
read write functions). I wanted to do this to show the a countdown of the
time out and a progress bar. That's works fine (I havent done the progress
bar but the timeout of the select works fine).
Now my problem is with the stdin File Descriptor. If a tested in the palm it
turns out that the stdin is always set, otherwise in the Emulator it is
never set. What I want is the stdin let me know when the user taps something
on the screen, knows where and if for example the user taps the application
button the reception of the data should be cancelled. Can somebody help me
do that without changing to much the style of my net layer. Thanks a lot.
Here is my read function.
int Read(void *buf, Word len) {
while (len) {
// Create the descriptor sets
netFDZero(&readFDs);
netFDZero(&writeFDs);
netFDZero(&exceptFDs);
netFDSet(sysFileDescStdIn, &readFDs);
netFDSet(peer, &readFDs);
width = sysFileDescStdIn;
width = 0;
if (peer > width) width = peer;
numFDs = NetLibSelect(AppNetRefnum, width+1, &readFDs, &writeFDs,
&exceptFDs, sysTicksPerSecond, &netErr);
if ( netFDIsSet(sysFileDescStdIn, &readFDs) ) {
// Do some cancel routine
}
if (netFDIsSet(peer, &readFDs) == 0) {
timeCount++;
} else {
if ( (cnt = NetLibReceive(AppNetRefnum, peer, buf, len, 0, NULL,
0, NETTIMEOUT, &netErr)) == -1) {
err = ERROR_GENERAL;
return err;
}
len -= cnt;
(unsigned char *) buf += cnt;
}
}
}