On Dec 13, 2007, at 06:02, Wilfried Mestdagh wrote:

> jes correct, except when session is closed at the moment that there is
> already some data in the buffer.

Oh, I understand:  I guess this is the reason why OnSessionClosed calls 
TriggerDataAvailable (I knew there was a valid reason for this).  
However, it does not check *properly* if there is more data.  As I 
mentioned in my original message, it only checks if FRcvCount is 
greater than zero (which is not reset until after the user event 
returns -- this is good because the user event may need it), and if 
FLineClearData is true (which only gets set if LineLimit has been 
exceeded).

My suggestion is to somehow set a flag to signal that the entire line 
has been received and that the buffer is empty *immediately* when the 
LineEnd is detected and before there is new data; and to do this before 
calling the user event.  Since FLineClearData seems to have an 
appropriate name (and is not being used for anything else), my 
suggestion is to set that flag before calling the user event if the 
received count is the same as the full received buffer (i.e. no more 
data after the LineEnd was received).

I do not oppose to using CloseDelayed as you suggest, and I even solved 
my issue by closing after OnDataSent is called (based on a Arno's 
suggestion to a previous question).  But I think that the fact that 
TWSocket.Close cannot be called during OnDataAvailable event, in 
LineMode, for risk of re-entering; or having to check if the receive 
buffer is empty before processing the event, are artifical and needless 
restrictions.

        What do you think?
        dZ.

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