Subject Re: [firebird-support] timeout a pending connection via a bad network?
Author Helen Borrie
At 09:41 PM 16/12/2005 +0100, you wrote:
>Nobody? All applications freeze when networkthroughput drops down to
>allmost zero or even stops at all?
>My case was a network (via internet) from which a ping returned about 5%
>of the packets... not to mention the turnaroundtime. Really bad
>performance. As I learned here that FB is rather "chatty" over the
>network, I can understand that in these circumstances it looks like the
>application locks up.
>I would like to signal the user that network is bad, and that it might
>be a good idea to try later... How would I do that?

Well, since you first posted this in a Delphi list, I assume you're
developing in Delphi.

It's your application's responsibility to verify that the network
connection is available. This isn't a Delphi list, so we're off-topic here
(but it's Saturday, and I'm the witich!) There are 101 ways to do this in
Delphi, with or without raw sockets. Just google delphi ping and they will
pour forth....Make this what your application does before it even attempts
to connect. Write a function that pings the server and sets a Boolean
property according to the ping response, e.g. NetworkAvailable, and test
this property in BeforeConnect:

procedure TForm1.cnBeforeConnect(Sender: TIB_Connection);
if not NetworkAvailable then
Showmessage('The network is not available.');
// execute your normal connection stuff

If you want to put a retry timer on it, that's a piece of cake,
too. Again, Google it; or just use the built-in timer in IBO's TIB_Session.