External Exception on reconnection after OS Suspend
Posted: Fri  09 Apr 2010 06:59
				
				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:
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.
			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;
External Exception: C00000006
error.
I must kill the application in Task Manager.
May you give some advice about that external exception?
Thanks.