Get updates to available client ASAP.
Update Server application to run a separate Thread for each client.
We have a program written in Delphi 2010 made to synchronize tables from a server to other computers in the LAN, it includes two services one on the workstation and one on the server.
The server reads jobs to be sent from the database, creates a TCP connection to each client and sends the update statement that the client needs to run.
Working with this project requires Advantage Database Components installed in Delphi 2010 but there is no need for Advantage Database Server (ADS) as the application could run in Advantage Local Server (ALS).
The ADS VCL components (version 10.1) could be downloaded from [url removed, login to view]
Program Flow and Notes:
Data structure on server-side is as follows:
ID //unique job ID
EXPR //Expression to send to clients
Comp //Computer name of Client
LastSync //TimeStamp to be updated periodically when last update was sent to client
ID //Child of Sync->ID
Comp //Computer name of client to receive this update
When a record (with a pending update) is added to the sync table a trigger adds an entry for each record in sync_comp to sync_msg wiith the ID of the new update and the name of the client.
When an update is properly delivered to a client the record of that client in sync_msg with the ID of the delivered update is deleted from sync_msg. A trigger then auto deletes the job from Sync if no other pending jobs exist in sync_msg with given ID.
If a client does not respond (service on client is off or client is off) all pending jobs for client should wait until client comes back online, but this should not keep other clients from receiving their updates ASAP with no delay at all.
When new clients register themselves with the server a new thread needs to be created for them as well.
The way Sync_Comp-> LastSync is updated needs to be modified to a settable value of how often the table should be updated.
Program needs to be rock solid, auto recover from any errors and with no memory leaks such as making new threads for old clients coming back online without deleting old threads.
In order to make it easy to debug I have written a program that you could run that would make mass changes to the table on the server.
Please specify your expertise in dealing with threads in Delphi (or better yet, send a demo to this effect) and I will send you the source. Include the words blue magic in your response so we could rule out spam.