Print Thread
How to restore connection?
#80 10/06/99 04:43 PM
Joined: Oct 1999
Posts: 3
Tallinn, Estonia
D
Dimik Offline OP
Member
OP Offline
Member
D
Joined: Oct 1999
Posts: 3
Tallinn, Estonia
How can I make application automaticly reconnect to server if server was rebooted?

Re: How to restore connection?
#81 10/06/99 05:31 PM
Joined: Oct 1999
Posts: 1
bergen/norway
R
Member
Offline
Member
R
Joined: Oct 1999
Posts: 1
bergen/norway
I have tried the Session.CheckConnection of D433 and it worked just fine with
something like this:

procedure TForm1.AHMTimer321Timer(Sender: TObject);
begin
if First = true then // avoid startup
if MySession.CheckConnection(true) <> ccOK then // still with us?
begin
Banner1.Enabled := true;
Banner1.Visible := true; // scroll text show server down
Down := true; // status indicating server down
end
else
begin // OK
Banner1.Enabled := false;
Banner1.Visible := false;
if Down then // we have been down and are now OK
begin // if so reopen queries
Eier.Active := false;
Eier.Active := true;
Down := false;
end;
end;

One weakness is using a timer -
I there another solution than using a timer?

Re: How to restore connection?
#82 10/06/99 10:54 PM
Joined: Sep 1999
Posts: 27
Germany
K
Member
Offline
Member
K
Joined: Sep 1999
Posts: 27
Germany
A solution without using timers could be to call CheckConnection before each call of Execute. If the result is not OK then call something like this:

[quote]
Code
REPEAT
  ... // Trigger some Banners or ...
  Sleep (<some ms> );
UNTIL (CheckConnection (TRUE) <> ccError) OR Application.Terminated;
[/quote]

------------------
Oliver Kaesmann


Oliver Kaesmann

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.033s Queries: 13 (0.008s) Memory: 2.5043 MB (Peak: 3.0418 MB) Data Comp: Off Server Time: 2024-05-14 07:45:50 UTC
Valid HTML 5 and Valid CSS