Hello:
    I'm using TWSocketThrdServer and processing
client data from within the OnDataAvailable event
handler (client is set to LineMode=True).  I've
noticed that if the data transaction is completed and
I call Client.Close from within this event, the event
is called again with the previous ReceivedStr.

Here's a sample of the code I am using:

Procedure TMyServer.HandleDataAvailable(Sender:
TObject; Error: Word);
Var
  DataStr: String;
  bDone: Boolean;
Begin
  If (Error = 0) Then Begin
    With (Sender As TMyClient) Do Begin
      DataStr := ReceiveStr;

      // parse the DataStr and do
      // whatever needs to be done.
      // bDone may be set here.

      If (bDone) Then Begin
        SendLine('Sayonara.');
        TMyClient(Sender).Close; // <<-- HERE!
      End;
    End;
  End Else Begin
    // Handle errors...
    TMyClient(Sender).Abort;
  End;
End;

When that Close method is called, the event is
immediately re-entered with the same data.  Am I
doing something stupid?

    Thanks,
    -dZ.

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to