Page 1 of 1
[ASK} Is there an event to notify when connection lost ?
Posted: 20.08.2011, 13:02
by coliv_aja
hi...
is there any event for detect if sometime connection lost,..
i'm using zeos 7 and mysql.
Posted: 21.08.2011, 12:05
by meltoywerks
try this it worked for me
try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
Posted: 21.08.2011, 16:19
by coliv_aja
meltoywerks wrote:try this it worked for me
try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
no, i mean notify if successfully connection got lost unexpected, your code will drop the connection, on idle thats maybe usefull, but if on edit, it will lost data...
i have figure it out with function ping or pingserver...
what i wanted if there any event if connection lost, like unidac, event onlostconnection...
now i have been using thread to monitor connection every few second, lot of time to create syncronizing method on all interface because annoying invalid window handle..
but nevermind i have done...
thanks for reply...
Posted: 21.08.2011, 16:29
by meltoywerks
ur welcome.
anyway, what is your purpose of monitoring your connection?
Posted: 21.08.2011, 16:40
by coliv_aja
sure, to notify if connection lost unexpected, like internet drop, or server dead...
Posted: 22.08.2011, 21:07
by seawolf
Have you tried ZConnection.PingServer?
Posted: 25.10.2011, 00:25
by amoarg69
HI! didi you solve the problem? I have ezxactly the same
please, tell me, its zeos dead?
anyway, what is your purpose of monitoring your connection?[/quote]