[Solved] Connection timeout?
Posted: 31.10.2017, 01:16
Hello,
Using SVN 4052 of library with Lazarus 1.8.0RC3 (actually 1.6.4 bugfix branch) on a Raspberry Pi 3, Raspbian.
Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
I had difficulties programmatic controlling of an IP number to identify if it's up (couldn't parse ping shell command output) and directly used TZConnection to check if remote system is up. If connection establishes, this means system is up. There are more than one single IP number and they are provided by another application (there is no human interaction). I have no option but to check them all, find first one up. Report if all fails.
This worked nicely until recently systems started to be mostly down and users started to wait and wait long times. For example Application running on 192.168.1.90 and IP number to check appear as 192.168.56.1. There are no routers between and that IP number is simply wrongly defined by remote system and due to fail connecting.
For a wrong provided *single* IP number, users have to wait 2 minute default TCP/IP timeout before TZConnection fails and application continue its check with next IP number in the list. On the other hand, if IP is fine, test finishes less than 110 milliseconds.
I also tried to use TZConnection.Ping() and TZConnection.PingServer() functions. I failed to find their right usage as they both return False even if IP number is fine and working with a TZConnection.Connect(). I believe they are to provide an option for keep-alive or something.
I am desperately trying to figure a way to shorten that time.
One solution comes up in mind is: if it is possible to provide a ConnectionTimeout value (maybe 2 seconds) to TZConnection? Or, maybe, it can be defined as an overloaded TZConnection.Connect(const ConnectionTimeout: Integer) method having ConnectionTimeout in milliseconds as a parameter?
I have no knowledge of TCP/IP connection details of ZeosLib or if there are any components used for that matter. However, I am willing to participate if it is doable.
I appreciate any help.
Thanks.
--Ertan
Using SVN 4052 of library with Lazarus 1.8.0RC3 (actually 1.6.4 bugfix branch) on a Raspberry Pi 3, Raspbian.
Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
I had difficulties programmatic controlling of an IP number to identify if it's up (couldn't parse ping shell command output) and directly used TZConnection to check if remote system is up. If connection establishes, this means system is up. There are more than one single IP number and they are provided by another application (there is no human interaction). I have no option but to check them all, find first one up. Report if all fails.
This worked nicely until recently systems started to be mostly down and users started to wait and wait long times. For example Application running on 192.168.1.90 and IP number to check appear as 192.168.56.1. There are no routers between and that IP number is simply wrongly defined by remote system and due to fail connecting.
For a wrong provided *single* IP number, users have to wait 2 minute default TCP/IP timeout before TZConnection fails and application continue its check with next IP number in the list. On the other hand, if IP is fine, test finishes less than 110 milliseconds.
I also tried to use TZConnection.Ping() and TZConnection.PingServer() functions. I failed to find their right usage as they both return False even if IP number is fine and working with a TZConnection.Connect(). I believe they are to provide an option for keep-alive or something.
I am desperately trying to figure a way to shorten that time.
One solution comes up in mind is: if it is possible to provide a ConnectionTimeout value (maybe 2 seconds) to TZConnection? Or, maybe, it can be defined as an overloaded TZConnection.Connect(const ConnectionTimeout: Integer) method having ConnectionTimeout in milliseconds as a parameter?
I have no knowledge of TCP/IP connection details of ZeosLib or if there are any components used for that matter. However, I am willing to participate if it is doable.
I appreciate any help.
Thanks.
--Ertan