ConnectionTimeout doesn't work
ConnectionTimeout doesn't work
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
Please specify what exact MyDAC version you use (3.XX.X.XX).
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.
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.
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.