The mystery is solved :)

On our server side we have a wrapping object per connected client, which 
takes care of a few things, amongst which sending keep alives and timing 
the connection out if needed.
If a timeout is detected, the wrapping object is freed, the clientside 
drops the connection, and this cleans up the socket server-side as well.

This all works well, except for a very occasional event, which could 
happen when a client timed out and the wrapping object was freed (as 
normal), and at that very moment a new client connected.
At this moment, it could happen that the memory manager instantiated the 
wrapping object for the new client at exactly the same memory location 
of the wrapping object which was just freed.
If at that moment, the socked of the previous client receive some data 
before the connection was closed, it triggered it's OnDataAvailable 
event, which was still set to the old wrapping object, but now of course 
came out in the new wrapping object.
This caused a call to ReceiveStr() on the wrong TCustomWSocket, causing 
the loop.

it took a while to find, but it's finally solved.

thanks for everybody thinking with me.

Francois PIETTE wrote:
>> I've looked for LSP, but didn't find anything, can you explain what you 
>> mean with it?
> --
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)

To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to