In my scenario, OnDataAvailable wasn't called the second time because of the message queue. The socket was being closed, and RcvdCnt > 0, so OnDataAvailable was being called to handle the remaining data.
Since my first OnDataAvailable had not finished before the exception occurred, the "metadata" about the current data (RcvdCnt and such) had not yet been cleared. The TriggerSessionClosed (not sure the exact function without looking it up) was not "aware" that OnDataAvailable had already been called for the current data. It was only "aware" that there was data that had not been processed and the socket was being closed, so the data "needed" to be processed. On Sun, Mar 28, 2010 at 3:27 AM, Markus Humm <markus.h...@freenet.de> wrote: > Hello, > > I never really understood why OnDataAvailable isn't called in a way > which hinders such reetrancy problems. Isn't the Windows message which > triggered it taken off the message queue by then? If not, why not? > > Greetings > > Markus > -- > 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 > -- Jon Robertson Borland Certified Advanced Delphi 7 Developer Good programming is 40% experience, 30% skill, 20% RTFM, 10% caffeine, and 5% attention to detail. -- 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