How can I keep the Advantage database connections timed out?
I have a windows service that runs on a benefit base and sometimes makes some HTTP calls. In rare cases, these calls can be very long. To set up the connection time to the database. I am not using a data module or anything else. Just create the connection manually.
My main question is what usually prevents the time from syncing if I just haven't used it after a while? How do TAdsComponents send a keep alive message that is called in the background? It depends on vcl, so I don't have this in my service? Somehow I feel like I am creating a thread to make my HTTP call and in the main thread checking to make sure it ends every few seconds would prevent the connection from dying. It's true?
source to share
Yes, there is a keepalive mechanism as you would expect. The client (for all communication types, TCP, UDP, Shared memory) pings the server so often that the server knows the connection is still alive. The frequency of this keepalive ping is based on the CLIENT_TIMEOUT server configuration parameter. With the default settings, I believe that keepalive ping is sent every 30 seconds.
The keepalive logic runs on a separate thread, which is run by the code that processes the message. In other words, it does not depend on any VCL components; if you have a connection to the server then this thread should work.
One way to check if your connections are down is to look at the Advantage error log. There should be 7020 disconnected connections errors.
Some things that come to mind that can lead to disconnected connections include:
- The client process is suspended for some reason, so the keepalive thread cannot run. It seems unlikely.
- The keepalive thread was killed for some reason. This also seems unlikely; you will need to go out of your way for this to happen.
- The firewall can close the connection if there is no activity for a while. I would think that a 30 second interval would be sufficient to prevent this.
- The firewall can deny UAL keepalive packets. Firewalls are inherently "suspicious" for UDP packets. You can make sure you are using TCP / IP.
source to share