View Full Version : TestConnection
Veiron
11-22-2008, 05:12 PM
Hi,
I put "Timeout = 5", and it all the same scans 20 seconds. For the sake of interest has put "Timeout = 30", the same 20 seconds.
It is necessary to scan fast 10 addresses, 200 seconds it it is a lot of.
What to do?
jassing
11-22-2008, 06:55 PM
Hi,
I put "Timeout = 5", and it all the same scans 20 seconds. For the sake of interest has put "Timeout = 30", the same 20 seconds.
It is necessary to scan fast 10 addresses, 200 seconds it it is a lot of.
What to do?
post your actual code.
Veiron
11-23-2008, 03:02 AM
HTTP.TestConnection("http://192.168.0.1", 20);
Connecting 20 seconds, ok.
HTTP.TestConnection("http://192.168.0.1", 3);
Connecting 20 seconds…
HTTP.TestConnection("http://192.168.0.1", 60);
Connecting 20 seconds…
if HTTP.TestConnection("http://192.168.0.1", 3) then
ServerIP = "192.168.0.1";
elseif HTTP.TestConnection("http://192.168.0.2", 3) then
ServerIP = "192.168.0.2";
elseif HTTP.TestConnection("http://192.168.0.3", 3) then
ServerIP = "192.168.0.3";
end
If all not correct to wait 1 minute.
Veiron
11-24-2008, 09:20 AM
Thus it is necessary to scan 10-15 IP addresses.
20 seconds for each, 200-300 seconds of all - too long.
Ulrich
11-24-2008, 09:50 AM
Hello,
this was recently confirmed as a bug and is currently being looked into.
Ulrich
Veiron
11-24-2008, 11:07 AM
Thanks, I will hope for fast correction.
Ulrich
11-24-2008, 03:13 PM
Thanks, I will hope for fast correction.
I doubt it very much. What needs to be corrected is the documentation, as timeouts can only be set while sending or receiving data through sockets, not for the connection.
There is no way to control directly the timeout for establishing a new connection: The mechanism and timings are coded into the TCP/IP stack of the operating system, and although you might tinker with the values in the registry (for example TcpMaxConnectRetransmissions), it wouldn't be advised as it would affect the whole computer. There are no means to alter these values directly, or to control how the TCP/IP protocol should behave for a single application.
In simple words, it works like this: When you try to establish a connection, the initial timeout for the operation is 3 seconds. If the connection fails (the socket gets no ACK answer to its SYN packet sent), the connection is restarted, doubling the initial timeout. If this connection fails again, a third attempt is made, doubling the timeout once again. Here you see why it takes about 20 seconds to get a negative to your connection attempt: 3 + 6 + 12 = 21 seconds. This is simply how the TCP/IP protocol works, and no application can work its way around this... What could be done is to place each connection attempt into a separate thread, and start monitoring the time of each thread created. When the allowed time is reached, the thread should have to be forcefully terminated... but this isn't something IR would be able to provide soon.
I hope that clears the issue a bit.
Ulrich
Veiron
11-24-2008, 04:24 PM
I experimented in due course and put different numbers from -5 to 1 million, as a result of 20 seconds exactly (on hours Windows). In the Help it is written, that this parametre is responsible "The maximum time in seconds that the action will wait for a response after attempting to connect.". Otherwise it should be realised in a Delphi application which will make it much faster, but it is less convenient, to that after Ping should start installation.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.