Page 1 of 1

External Exception on reconnection after OS Suspend

Posted: Fri 09 Apr 2010 06:59
by brace
I use one single TMSConnection in my application.

When there is a disconnection I use the OnConnectionLost event in this way to reconnect, before trying to reconnect I ask the user if he wants to reconnect (this makes sense because may be he incidentally unplugged a LAN cable or switched off wireless).

This is the code I use, I removed things specific to my app, I just left the SDAC part:

Code: Select all

procedure TForm1.OnConnectionLost(Sender: TObject; Component: TComponent;
  ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
  if  MsgBox('Connection lost detected. Do You want to try to  reconnect?',
   MB_ICONWARNING + MB_YESNO) = mrYes 
    then  RetryMode := rmReconnectExecute
 else
 begin
     RetryMode := rmRaise;
     Application.Terminate;
  end;
end;

On my laptop when I close monitor the system (Windows Vista) goes on Suspended mode. As I open the screen again the OnConnectionLost event fires and I am propmpt to reconnect. Sometimes (not always) the first time I try to open a dataset in my application it doesn't work and I have an

External Exception: C00000006

error.

I must kill the application in Task Manager.

May you give some advice about that external exception?

Thanks.

Posted: Mon 12 Apr 2010 12:47
by Dimon
Please, try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Posted: Wed 14 Apr 2010 14:42
by brace
may be I got the problem:

the OnConnectionLost event doesnt' dire immedaitely. Imagine I disconnect LAN cable from machine.

I have some timers in my application.

During OnConnectionLost event handler I set a ConnectionLost flag to True.

in timers execution code i check for ConnectionLost to be False.

Anyway if the situation is this:

1) LAN disconnection
2) Timer.Execute
3) OnConnectionLost

I have the problem... May this be? Becuse it isnot a 100% reproducable behaviour.

Posted: Fri 16 Apr 2010 08:01
by Dimon
I did not fully understand what you mean. Please give a sample of a code that you are using.