Hello all,

   I'm using ICS version 6.06 with Turbo C++ Explorer 2006.

   I had been fighting a problem where my DataAvailable event was being 
called twice as many times (minus 1) as actually needed.  Since I've 
been using the ICS components for many, many years now, I obviously 
started looking to see if somehow I was calling ProcessMessages again 
within the DataAvailable.  I couldn't find any where that was true.

   I finally looked into the TWSocket sources to see where DataAvailable 
was triggered from and to see if anything there would make it act this 
way.  This is when I saw this wsoNoReceiveLoop thing (which is 
apparently off by default).  Turning that option on made my problem go away.

   My question is, what am I missing?  Either I don't understand why you 
would *want* ASyncReceive to loop, or maybe I'm not correctly reading in 
the data?  The component I'm working on receives large amounts of data 
from a server in successive blocks.  From what I observed, my 
DataAvailable event was being called twice minus one more times than it 
needed to be.  For example, if the server sent 6 blocks of data, my 
DataAvailable event would get called 6 times to receive all of the data, 
then get called 5 more times.  In the 5 extra times, my code would 
attempt to do a Receive, which would return -1 along with the "Would 
Block" winsock error.

   So, it seems that for every time ASyncReceive looped, there would 
still be a message (FD_Read??) being put in the queue to call it again, 
which would call my DataAvailable event again, but there wouldn't be any 
data to read because ASyncReceive had already looped to get all the 
data.  Again, am I missing something here?  Should there have only been 
one FD_Read in the queue initially which would start the ASyncReceive 
loop but some how the queue is getting corrupted (by some call to 
ProcessMessages maybe) causing it to respond to the FD_Read more than 
once.  Or should there be an FD_Read for every block of data coming from 
the server, and if that's the case, why does ASyncReceive loop?  Because 
if there is an FD_Read for every block of data, then ASyncReceive and 
any DataAvailable events would be called multiple times.

Help! :)


Jake Traynham
Owner, CNS Plug-ins
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to