Subject | Re: [IBO] What to do when cn->Connect() fails |
---|---|
Author | Helen Borrie |
Post date | 2004-12-17T22:14:27Z |
At 03:44 PM 17/12/2004 +0000, you wrote:
the network that says the client is connected to the database.
network. While the host is still doing its host resolution stuff, there
are still responses coming back as the TCP/IP service cycles through all of
its options.
My network (TCP/IP, with 8 allowed hosts configured in HOSTS on Win2K)
takes between 40 and 45 seconds to return the following message to the
application when I use your example IP address:
ISC ERROR CODE:335544721
ISC ERROR MESSAGE:
Unable to complete network request to host "1.1.1.1".
Failed to establish a connection.
unknown Win32 error 10060
It makes no difference whether the server's ConnectionTimeOut is 10s or
180s, since DNS resolution is continually trying and failing each option in
its cycle at subsecond intervals (this is a very plain, regular, switched
100 Mbps LAN with very few nodes).
server. It seems fairly common for DNS resolution on XP and Winserver2003
to be slow, though it's not something I've got the capability to test on my
system.
Why are you using ad hoc WinAPI calls to intercept this error? The client
library implements the network communication layer. It will pass back any
socket errors to the application -- this is what your application should
listen for and respond to.
Try it with IB_SQL. Once the client knows the connection is hopeless, you
should see a normal EIB_ISCError, along with errorcode that you need to
catch in OnError:
ISC ERROR CODE:335544721
ISC ERROR MESSAGE:
Unable to complete network request to host "1.1.1.1".
Failed to establish a connection.
unknown Win32 error 10060
What you do with the application after that is up to you. The main form's
existence isn't dependent on a successful connection unless you make it so.
Helen
>How do I handle a failed connection gracefully?In the sense that the client is still listening for a response back from
>
>Within my datamodule, if I set the server to be 1.1.1.1 (i.e. where I
>know it will fail), cn->Connect() throws a 335544721 ISC exception after
>around 40s.
>
>If I then try to exit the application, either by PostQuitMessage or
>throwing an exception to WinMain exception handler, the application
>still appears to be running. Is it still trying to connect to
>Firebird somehow?
the network that says the client is connected to the database.
>Also, is there a way to reduce the time it spends trying to connect toThat setting starts ticking when there is no response from the
>the server before it gives up? I've changed the client firebird.conf
>ConnectionTimeout to 8s instead of 180s, but this doesn't appear have
>made any difference.
network. While the host is still doing its host resolution stuff, there
are still responses coming back as the TCP/IP service cycles through all of
its options.
My network (TCP/IP, with 8 allowed hosts configured in HOSTS on Win2K)
takes between 40 and 45 seconds to return the following message to the
application when I use your example IP address:
ISC ERROR CODE:335544721
ISC ERROR MESSAGE:
Unable to complete network request to host "1.1.1.1".
Failed to establish a connection.
unknown Win32 error 10060
It makes no difference whether the server's ConnectionTimeOut is 10s or
180s, since DNS resolution is continually trying and failing each option in
its cycle at subsecond intervals (this is a very plain, regular, switched
100 Mbps LAN with very few nodes).
>Using BCBv5, FBv1.5, IBO v4.3AaWhat matters is the setup of your TCP/IP services, at client and
server. It seems fairly common for DNS resolution on XP and Winserver2003
to be slow, though it's not something I've got the capability to test on my
system.
Why are you using ad hoc WinAPI calls to intercept this error? The client
library implements the network communication layer. It will pass back any
socket errors to the application -- this is what your application should
listen for and respond to.
Try it with IB_SQL. Once the client knows the connection is hopeless, you
should see a normal EIB_ISCError, along with errorcode that you need to
catch in OnError:
ISC ERROR CODE:335544721
ISC ERROR MESSAGE:
Unable to complete network request to host "1.1.1.1".
Failed to establish a connection.
unknown Win32 error 10060
What you do with the application after that is up to you. The main form's
existence isn't dependent on a successful connection unless you make it so.
Helen