Make sure you are setting/clearing g_bBusy in the right places and at the 
right time.  Could it be that the first time it falls through with g_bBusy 
== TRUE and the EvtGetEvent times out, like it should, but then you are 
setting it FALSE, thinking you are done before you are?

You could also do{}until nBytesRead == 0 to completely flush the socket 
whenever you read ( unless thats what you are already doing in 
NetGetDataFromSocket ).

Just some ideas.  Hope they help.

spike

>From: Alan hand <[EMAIL PROTECTED]>
>Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>Subject: RE: Troubles with NetLibSelect in main event loop
>Date: Mon, 11 Jun 2001 16:35:40 -0700

>
>I agree...the only problem is that I have a timeout value of one tick if 
>I'm
>busy posting...shouldn't this prevent EvtGetEvent from blocking until an
>event arrives?
>
>
>-----Original Message-----
>From: John Stephenson [mailto:[EMAIL PROTECTED]]
>Sent: Monday, June 11, 2001 3:36 PM
>To: Palm Developer Forum
>Subject: Re: Troubles with NetLibSelect in main event loop
>
>
>Now that I have been able to reformat the code so I could read it ( the 
>post
>
>messed it up on my PC ) it looks like you are falling into your EvtGetEvent
>processing without checking to see if netFDIsSet(sysFileDescStdIn,
>readFDs)so you get stuck there.
>
>spike
>
>
> >From: Alan hand <[EMAIL PROTECTED]>
> >Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> >To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> >Subject: Troubles with NetLibSelect in main event loop
> >Date: Mon, 11 Jun 2001 11:43:50 -0700
> >
> >I am having troubles implementing NetLibSelect in my main event loop in
> >order to handle both data from a socket and user input.  The problem I am
> >experiencing is that NetLibSelect seems (it's a little hard to tell for
> >sure
> >since I can't debug on the emulator) to not set the FD for the socket 
>even
> >though data is available.  The first time around everything goes fine, 
>and
> >some data is read from the socket.  On the next iteration of the loop, 
>even
> >though there is still data left to be read (as the read did not read all
> >available data) NetLibSelect says that there is nothing to read.  The app
> >then hangs in this state until an event comes along (i.e. a pen tap) and
> >then for some strange reason NetLibSelect says that data is available and
> >the data is read.  This whole process is repeated over and over again, an
> >din order for my program to successfully download a large chunk of data I
> >must continually tap the screen!  I can't seem to figure out why this is
> >happening, and the fact that I can't use the debugger with NetLibSelect 
>and
> >sysFileDescStdIn makes my life that much harder.  Has anyone else run 
>into
> >similar problems?  Can anyone find anything wrong in my code?
> >
> >Thanks in advance,
> >Alan
> >
> >----------------------------
>[snip]
> >
> >                     EvtGetEvent(&event, (!g_bBusy) ? evtWaitForever :
> >1);
> >                             if (! SysHandleEvent(&event))
> >                                     if (! MenuHandleEvent(0, &event,
> >&error))
> >                                     if (! AppHandleEvent(&event))
> >                                             FrmDispatchEvent(&event);
> >
> >                     } while (event.eType != appStopEvent);
> >             }
> >     return;
> >}
> >
> >--
> >For information on using the Palm Developer Forums, or to unsubscribe,
> >please see http://www.palmos.com/dev/tech/support/forums/
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe,
>please see http://www.palmos.com/dev/tech/support/forums/
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, 
>please see http://www.palmos.com/dev/tech/support/forums/

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


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