Page 1 of 1

ZConnection hangs for nonexistent server

Posted: 14.07.2009, 06:15
by jfr
I'm using version 6.6.4 with Delphi 6. Trying to connect to mysql database:

ZConnection.HostName:='ahost';
ZConnection.Protocol:='mysql';
ZConnection.Port:=3306;
ZConnection.User:='root';
ZConnection.Password:='password';
ZConnection.Connect;

And now if ahost address connot be found then program hangs and wait forever. How to avoid it? I've tried to add

timeout=10

to ZConnection.Properties, but it didn't work.

Posted: 13.10.2010, 15:22
by zash3000
I have the same problem.
I have tried the same, before I came here.

Somebody tell us how to set a reasonable timeout, please.

Posted: 13.10.2010, 19:56
by guidoaerts
maybe you find something in this thread:
http://zeos.firmos.at/viewtopic.php?t=2049
Guido

Posted: 14.10.2010, 09:47
by zash3000
That thread is about loosing a connection. It's not my case.

My problem appears when I try to connect and the server is down or doesn't exist.

In 1-2 minutes after ZConnection.Connect there raises an exception, but this time is too long. I need to fix timeout to a shorter period, like 5-10 seconds.

Give another answer, please.

Posted: 19.10.2010, 17:11
by guidoaerts
There are two ways to explore this:
ZConnection.Pingserver looks for the server or
in Zconnection.properties you can add 'timeout=120' (but i don't know for sure if that is the right way)...
guido

Re: ZConnection hangs for nonexistent server

Posted: 16.03.2016, 12:38
by duzenko
Does Ping not only work for if there is a connection already?
I.e. you can't test for Ping before Connect