Page 1 of 1
ConnectionTimeout doesn't work
Posted: Thu 30 Dec 2004 21:32
by GEswin
I'm in a case that I wan't to try to connect to a remote server, but if I can't in 1 or 2 seconds, then connect to a local server. I changed the ConnectionTimeout propertie, but it's always 15 seconds, whatever I set.
Re: ConnectionTimeout doesn't work
Posted: Fri 31 Dec 2004 07:37
by Ikar
Please specify what exact MyDAC version you use (3.XX.X.XX).
Posted: Tue 04 Jan 2005 11:25
by GEswin
I tried both with 3.00.1.4 and 3.30.1.13, and both fail. The connections times out after 15 seconds and not at the time set.
Posted: Tue 04 Jan 2005 12:09
by Ikar
Please try 3.30.2.15
Posted: Wed 05 Jan 2005 14:04
by GEswin
Well, just upgraded to 3.30.2.15 (D7) and still doens't work. I set for example 2 seconds on ConnectionTimeout, and still waits 15 seconds.
Posted: Thu 06 Jan 2005 10:32
by Ikar
We carefully checked possible reasons of this behaviour. The problem is in impossibility to set timeout for some WinSock functions - gethostbyname and connect.
As a solution we can advise you the next variants:
1) Establish a connection at the separated thread.
2) Before calling TMyConnection.Connect, execute ping for a specified server. If ping is succeeded (host is available), in this case a connect (reject in connection) happens quickly.
Posted: Mon 10 Jan 2005 14:54
by GEswin
Thanks Ikar for the tip. I've done this, and improved a lot my problem, which was specifing to connect to movile computers, which lose/reconnect and change their IP lot of times during the day. Now I have a quick metod to try to connect. If after 1 seg ping fails, then I don't connect, but just show mirrored information.