Subject Re: Firebird Ver 1.5 + Events + Firewall/Router. Questions
Author Adam
--- In, "jarrod_petz" <petz@...>
> I just wanted to make some enquires as to how events work in
> ver 1.5.
> Our development team is currently using the events feature of
> to do asynchronous message passing between a server and multiple
> clients over a local area network. A rough outline of what we are
> doing is described below
> 1. A client is going to make a request to a server process that will
> take a long time to return data. Rather then block the client until
> the data is ready we allow them to continue working. The client will
> register an event in the Firebird database and start listening to
> event before making the call to the server to start retrieving its
> 2. The server receives the request to retrieve data from the client
> along with the details of the database event it should post to when
> the data is ready. The server process proceeds to do its work and
> post to the event when finished.
> 3. The client process listening to the database event is notified
> the server process is finished and can access the data it wanted.

Events are useful for notifying other clients of changes to the
table. Presumably if you are allowing the user to continue working
until the data is ready, you this connection and transaction running
in a background thread. In this case, it would be easier IMO to let
the background thread synchronize with the VCL thread once finished
than to create an 'event object' that is waiting in another thread
anyway doing the same thing.

> Everything seems to run fine when the Windows firewall is turned off
> or when the fbserver.exe is permitted in the firewall exception
> However if the firewall is active with only port 3050 open for
> Firebird our application locks up and stalls when the client tries
> registering the event in step one. Sometimes this also
> stalls/crashes/locks the fbserver process as well bringing down the
> entire system. I can see from using a port monitor that fbserver.exe
> seems to start a new server on a new random port for each client
> registers a event. No doubt this is probably for the client to
> and listen to for when the server posts to the event. However should
> the windows firewall be blocking these new random ports?

Yes it should be.

>If so what is
> the recommended way to configure a Firebird server so event work,
> on a intranet and behind a router which I believe will have the same
> problem however most routers wont be able to allow a certain
> executable on a certain machine to open ports? Should the
> not be punching holes in NAT/firewalls by sending an outgoing packet
> to the person registering the event?

Look in firebird.conf at RemoteAuxPort, and restart the service after
any changes. If you are using a secure channel, then you will have to
have in place the appropriate firewall rules to allow the server to
contact back to the client on that port.

We use a different approach in that the server stores in a holding
table the PK of the data that has been changed, and when the client
synchronises, we send this data down. It is a poll mechanism rather
than an asynchronous call, however we do not have to worry about
trying to make a connection from the server to a client through NAT
and whatever else, and have our system fall over every time some
goose resets all the rules on the router.