Olivier Sannier wrote:
> Isn't it what CloseDelayed is meant for?
CloseDelayed won't reenter the event, however to ensure that
last data packets are received properly before the socket is
closed call ShutDown() for a gracefull close in DataSent event
Arno Garrels [TeamICS]
> Francois Piette wrote:
>> You should call Shutdown to gracefully close the connection.
>> If you want to call close, do it using an intermediate custom
>> message. --
>> [EMAIL PROTECTED]
>> Author of ICS (Internet Component Suite, freeware)
>> Author of MidWare (Multi-tier framework, freeware)
>> ----- Original Message -----
>> From: <[EMAIL PROTECTED]>
>> To: <email@example.com>
>> Sent: Wednesday, October 03, 2007 12:04 AM
>> Subject: [twsocket] TWSocketThrdServer - Bogus OnDataAvailable
>> triggeredwhen Closed.
>>> 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);
>>> DataStr: String;
>>> bDone: Boolean;
>>> 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
>>> TMyClient(Sender).Close; // <<-- HERE!
>>> End Else Begin
>>> // Handle errors...
>>> When that Close method is called, the event is
>>> immediately re-entered with the same data. Am I
>>> doing something stupid?
>>> 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
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