RemoteDB server AfterDisconnect event

Hi,
I recompiled my old RemoteDB server with a newer version (2.17.3.4) and seems that the onAfterDisconnect event is no more fired...
The onAfterConnect event is still triggered.
In my server I use TFDConnection instead of Aurelius connection, but in the past it always worked...
Can you help ?

Regards

When do you expect OnAfterDisconnect to be fired? Which test did you try to do?
RemoveDB doesn't necessarily close the connection all the time. Do you have a sample project reproducing the issue?

Hi, in my client app I make an explicit RemoteDB disconnet when finished the DB update job.

RemoteDBDatabase1.Connected := False;

Thus on server side I have always seen the Connect and Disconnect of my clients.
After the upgrade of my projects with newer vesion, the disconnect event on server side seems no more fired.
I have a test program, server+client in attach.
RemoteDB_cliserv.zip (171.3 KB)

Reason is actually RemoteDB server is destroying the database component when the client asks for disconnection. In that case, the AfterDisconnect event is not fired:

      if Assigned(AfterDisconnect) and not (csDestroying in ComponentState) then
        AfterDisconnect(Self);

But this check on database component was introduced in newer RemoteDB releases ?
No way to get again the Disconnect event ?

That code is from Delphi TDataset, not RemoteDB. If the component is destroyed, AfterDisconnect event is not called.

Maybe in early versions of RemoteDB the component was not destroyed, but kept alive in the server, which is not ideal.

You can use OnDestroy event in addition to AfterDisconnect to check if a component is destroyed.

Ok, I have changed my architecture using the RemoteModule OnDatabase Create and Destroy
to trace the connections.
And also found the ClientID property in IDatabaseInfo which I'll use with SerialNumber of my Android devices :slight_smile:
Thank you !

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.