Hello, I have question how to check if Client datasnap loss connection from server?

Hello, I have question how to check if Client datasnap loss connection from server?
i try use :
if SQLConnection1.Connected then
   ShowMessage('Connected')
else
   ShowMessage('DisConnect');

but this not work. if Server disConnect condition of SQLConnection still connected.
Thanks you

Comments

  1. What I did was to add a global handler for unhandled exceptions, where I parse the exception to get the db error code. If it's a disconnect I show a dialog informing the user and call Application.Terminate. Not the most elegant but works.

    ReplyDelete
  2. Which type of connection are you using? TCP/IP or HTTP? For TCP/IP there is a keepalive mechanism that can let you track the status of a connection...

    ReplyDelete
  3. Im using TCP/IP, keepalive mechanism in server or client marco?

    ReplyDelete

Post a Comment