Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Server notifying a client ?
Sun, Jan 16 2011 11:42 AMPermanent Link

Oliver

METTRIX

My little program is coming along. Right now it consists of an app, call it the "Master", that writes into the database and a totally separate app, call it the "Display", that gets info from the same database and updates info on its window.

Right now "Display" uses polling. Most of the time there is nothing
to update on the window and rather than polling at regular intervals for example, I would rather have the server
notify  "Display" that a row in a particular table has been updated.

Is there an easy way to do this in EDB?

Thanks

Oliver
Mon, Jan 17 2011 4:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Oliver


AFAIK there's nothing built in yet. Tim has promised something (can't remember if it will be c/s or just the fabled enterprise edition). Right now your best approach is to build your own. If Master and Display are on the same PC you could probably get away with using Windows messaging. On different PC's you need to look at different approaches. Look at Synapse (free and very good) or Indy (comes with Delphi but always gave me a headache).

The exact approach will depend on the configuration and what you want to achieve. UDP may be the most appropriate.


Roy Lambert [Team Elevate]
Mon, Jan 17 2011 5:05 AMPermanent Link

Uli Becker

Oliver,

> Is there an easy way to do this in EDB?

In a network I use Indy-components like Roy indicated:

Just put

TIdUDPServer
TIdUDPClient

on the main form of your applications. Set Port and Default Port to the
same port (e.g. 1890) and set active := true

Here some sample code:

procedure THauptForm.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
AData: TBytes; ABinding: TIdSocketHandle);
var
  s: string;
begin
  s := Copy(BytesToString(AData), 0, length(AData));
  if ABinding.PeerIP <> GStack.LocalAddress then
  begin
    // Refresh database or do something using s
  end;
end;

procedure THauptForm.btnTestClick(Sender: TObject);
var
  MyIdentifier: string
begin
  MyIdentifier := 'MyTable'; // e.g. to identify the table that has
been refreshed
  IDClient.Broadcast(MyIdentifier, 8090);
end;

Hope, that helps.

Regards Uli
Mon, Jan 17 2011 6:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Oliver


Just had another thought. UDP is a good way forward but another approach is to move the polling to a background thread which can then send a message to the foreground to tell it to update.

I'm doing this in an app where it checks three different sets of tables, one of which is emails to see if there are any new emails for a specific user,

Roy Lambert [Team Elevate]
Wed, Jan 19 2011 7:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Oliver,

<< Is there an easy way to do this in EDB? >>

Not currently, but its high on the list:

http://www.elevatesoft.com/roadmap?category=edb

"Messaging layer for general messaging notifications and broadcasts with the
ElevateDB server"

The issue is that the comms layer needs to be re-architected to be
asynchronous, whereas the current architecture is strictly request/reply
with a thread per session.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image