But TWSocket will swallow the exception, so use this:
var
AFlag:Boolean
procedure TForm.WSocketDataAvailable(Sender: TObject; ErrCode: Word);
begin
try
if AFlag then
raise Exception.Create('reentered');
AFlag := TRUE;
try
[..]
finally
AFla
e, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
- Original Message -
From: "Markus Humm" <[EMAIL PROTECTED]>
To:
Sent: Friday, September 01, 2006 7:25 AM
Subject: [twsocket] OnDataAvailable and Reetrancy
> > Can OnDataAvai
Markus Humm wrote:
> I don't call processmessages and the like directly in the event but
> might output some lines on screen for debugging.
How? ShowMessage is a modal form.
>
> Other thing: what about critical sections. Would they be safe for
> preventing this in my situation?
No, critical
> Can OnDataAvailable be called while it is
> > already running?
> > And if yes, how to prevent this? Is using critical
> > sections a good idea here?
> You must avoid having the events reentered. To avoid this, you simply
> have
> to _not_ call any form of the message pump from the events. The
>
TED]>
To:
Sent: Thursday, August 31, 2006 8:20 PM
Subject: [twsocket] OnDataAvailable and reetrancy
> Hello,
>
> I've a server and a client app. which communicate through a TCP based
> protocoll I designed.
>
> The server get's requests which in OnDataAvailable are re
Hello,
I've a server and a client app. which communicate through a TCP based
protocoll I designed.
The server get's requests which in OnDataAvailable are received into a
1500 Byte sized array (most time the app. will run on a LAN) whose
contents is copied into a larger buffer then since the reque