Board index » delphi » Problem with indy socket client

Problem with indy socket client

I have the following code that works but throws a EIdNotConnected exception
when I try to disconnect if I am running it from the IDE.  No error if I run
outside of ide.  Does anyone have any idea why the exception is not caught
and the thread terminate?

Thanks.

Christoph

procedure Treceivethread.Execute;
begin
    while (not Terminated) and (Form1.idTCPClient1.Connected) do begin
      txt := '';
      if Form1.idTCPClient1.Connected  then begin
        try
          txt := form1.IdTCPClient1.ReadLn();
        except
          Terminate;
        end;
        if txt <> '' then
          Synchronize(Receive);
        end
      else
        Terminate;
    end;
end;

 

Re:Problem with indy socket client


Quote
Christoph Donges wrote:
> I have the following code that works but throws a EIdNotConnected exception
> when I try to disconnect if I am running it from the IDE.  No error if I run
> outside of ide.  Does anyone have any idea why the exception is not caught
> and the thread terminate?

> Thanks.

> Christoph

Take a look at the Language Exceptions tab in Tools|De{*word*81} Options.
I'll bet "Stop on Delphi Exceptions" is checked.  This will stop the IDE
on any exception.  Even ones that will be caught in a Try..Except.

You can avoid this by either unchecking this option or testing outside
of the IDE.

Regards,
Bruce McGee
Glooscap Software

Re:Problem with indy socket client


Thanks.  That works.

Christoph

Quote
"Bruce McGee" <bmc...@ionline.net> wrote in message

news:3ed5fbba$1@newsgroups.borland.com...
Quote
> Christoph Donges wrote:
> > I have the following code that works but throws a EIdNotConnected
exception
> > when I try to disconnect if I am running it from the IDE.  No error if I
run
> > outside of ide.  Does anyone have any idea why the exception is not
caught
> > and the thread terminate?

> > Thanks.

> > Christoph

> Take a look at the Language Exceptions tab in Tools|De{*word*81} Options.
> I'll bet "Stop on Delphi Exceptions" is checked.  This will stop the IDE
> on any exception.  Even ones that will be caught in a Try..Except.

> You can avoid this by either unchecking this option or testing outside
> of the IDE.

> Regards,
> Bruce McGee
> Glooscap Software

Other Threads