Hi
I have a TUniConnection in my client program that connect to a remote database with IP address
I want to show a dialog if the connection lost , I have used OnConnectionLost event , but for example when I disconnect pc from Internet , the OnConnectionLost don`t occur ! ( or OnAfterDisconnect )
TUniconnection Options is :
DisconnectMode = False
AllowImplicitConnect = False
LocalFailOver = True
After disconnecting from Internet , TUniQueries are Inactive but OnConnectionLost don`t occur
It seems this event occurs only if connection get lost during a Query or Executing commands , is it True ?
How can I recognize if the connection failed ?
I`m using Delphi XE6 and MySQL
thanks
OnConnectionLost on remote connect
Re: OnConnectionLost on remote connect
Any Help !?
Re: OnConnectionLost on remote connect
The AfterDisconnect event occurs only when you explicitly disconnect from MySQL server, for example, by calling the TUniConnection.Disconnect method.
The OnConnectionLost event occurs not at the moment of disconnection, but in case when after connection breaks you are trying to access the server. Since you don't try to access the server after disconnection from the Internet, the OnConnectionLost event doesn't occur. The simplest way to check if the connection is lost is to send any command to the server via UniDAC, e.g., TUniConnection.Ping. If on execution of the TUniConnection.Ping method the server is unavailable, the OnConnectionLost event occurs.
The OnConnectionLost event occurs not at the moment of disconnection, but in case when after connection breaks you are trying to access the server. Since you don't try to access the server after disconnection from the Internet, the OnConnectionLost event doesn't occur. The simplest way to check if the connection is lost is to send any command to the server via UniDAC, e.g., TUniConnection.Ping. If on execution of the TUniConnection.Ping method the server is unavailable, the OnConnectionLost event occurs.