Board index » delphi » Weird exception occurring "exception unknown software exception (0x0eedfade) "

Weird exception occurring "exception unknown software exception (0x0eedfade) "

I've solved your problem the following way, sorry for not having time to
analyze your code thoroughly.
unit TIdTCPSoftConnectClient;
uses
  Windows, Messages, SysUtils, Classes,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, syncobjs,
IdGlobal;

  TIdTCPSoftConnectClient = class(TIdTCPClient)
  private
    { Private declarations }
    FUseConnectThread: boolean;
    FConnecting: boolean;
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

    procedure Connect; override;
    procedure Disconnect; override;

    property Connecting: boolean read FConnecting stored false;
  published
    { Published declarations }
    property UseConnectThread: boolean read FUseConnectThread write
FUseConnectThread default false;
  end;

implementation
uses
  IdAntiFreezeBase;

type
  TProc = procedure() of object;
  TExcClass = class of exception;
  TIdConnectThread = class(TThread)
  public
    ConnectProc: TProc;
    errormsg: string;
    done: boolean;
    excclass: TExcClass;
    procedure Execute; override;
  end;

constructor TIdTCPSoftConnectClient.Create(AOwner: TComponent);
begin
  inherited;
  FUseConnectThread := false;
  FConnecting := false;
end;

destructor TIdTCPSoftConnectClient.Destroy;
begin
  if Connecting then Binding.CloseSocket;
  Disconnect;
end;

procedure TIdTCPSoftConnectClient.Connect;
begin
  if not UseConnectThread
    then inherited
  else
    with TIdConnectThread.Create(true) do
    try
      TMethod(ConnectProc).Code := Addr(TIdTCPClient.Connect);
      TMethod(ConnectProc).Data := self;
      FConnecting := true;
      resume;
      repeat
        sleep(10);
        TIdAntiFreezeBase.DoProcess(true);
      until done;
      FConnecting := false;
      if assigned(excclass)
        then raise excclass.Create(errormsg);
    finally
      free;
    end;
end;

end.

This is the best I've been able to come up with so far, if there are any
serious bugs in it I'd definitely like to know.

XPost&F'up2 borland.public.delphi.internet.winsock

johannes

 

Re:Weird exception occurring "exception unknown software exception (0x0eedfade) "


Quote
> I've solved your problem the following way, sorry for not having time to
> analyze your code thoroughly.

Ooops, I definitely did want to say one thing: Your code probably does
something wrong with the thread - letting it run or something...

johannes
--
Please reply in this newsgroup only
 - SIP solutions -
http://www.sipsolutions.de/

Re:Weird exception occurring "exception unknown software exception (0x0eedfade) "


Thank you Johannes for your time to try and solve it. I
will test out your code tonight and report back.

Regards Gareth

Quote
"Johannes Berg" <johannes.berg.n...@gmx.net> wrote in message

news:3A681582.6BF1FE7@gmx.net...
Quote
> I've solved your problem the following way, sorry for not having time to
> analyze your code thoroughly.

> unit TIdTCPSoftConnectClient;
> uses
>   Windows, Messages, SysUtils, Classes,
>   IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, syncobjs,
> IdGlobal;

>   TIdTCPSoftConnectClient = class(TIdTCPClient)
>   private
>     { Private declarations }
>     FUseConnectThread: boolean;
>     FConnecting: boolean;
>   protected
>     { Protected declarations }
>   public
>     { Public declarations }
>     constructor Create(AOwner: TComponent); override;
>     destructor Destroy; override;

>     procedure Connect; override;
>     procedure Disconnect; override;

>     property Connecting: boolean read FConnecting stored false;
>   published
>     { Published declarations }
>     property UseConnectThread: boolean read FUseConnectThread write
> FUseConnectThread default false;
>   end;

> implementation
> uses
>   IdAntiFreezeBase;

> type
>   TProc = procedure() of object;
>   TExcClass = class of exception;
>   TIdConnectThread = class(TThread)
>   public
>     ConnectProc: TProc;
>     errormsg: string;
>     done: boolean;
>     excclass: TExcClass;
>     procedure Execute; override;
>   end;

> constructor TIdTCPSoftConnectClient.Create(AOwner: TComponent);
> begin
>   inherited;
>   FUseConnectThread := false;
>   FConnecting := false;
> end;

> destructor TIdTCPSoftConnectClient.Destroy;
> begin
>   if Connecting then Binding.CloseSocket;
>   Disconnect;
> end;

> procedure TIdTCPSoftConnectClient.Connect;
> begin
>   if not UseConnectThread
>     then inherited
>   else
>     with TIdConnectThread.Create(true) do
>     try
>       TMethod(ConnectProc).Code := Addr(TIdTCPClient.Connect);
>       TMethod(ConnectProc).Data := self;
>       FConnecting := true;
>       resume;
>       repeat
>         sleep(10);
>         TIdAntiFreezeBase.DoProcess(true);
>       until done;
>       FConnecting := false;
>       if assigned(excclass)
>         then raise excclass.Create(errormsg);
>     finally
>       free;
>     end;
> end;

> end.

> This is the best I've been able to come up with so far, if there are any
> serious bugs in it I'd definitely like to know.

> XPost&F'up2 borland.public.delphi.internet.winsock

> johannes

Other Threads