This looks good to me. I would suggest lowering the timeout to 0.001 from 0.1 . On Windows XP there is a significant difference in the amount of time the code will actually wait to timeout between 0.1 - approx 160 milliseconds - and 0.01 - approx 60 milliseconds. This will dramatically improve the chances of the test passing even if the IP address happens to exist. The measured difference between a timeout setting of 0.01 and 0.001 is negligible (on Windows XP anyway), but I would think that 0.001 would translate to a timeout of 1 millisecond in the java code and may become relevant in the future.
From: Alan Kennedy <email@example.com>
To: Raghuram Devarakonda <firstname.lastname@example.org>
Cc: JythonDevelopers <email@example.com>; Charlie Groves <firstname.lastname@example.org>
Sent: Thu, 26 Jul 2007 2:47 pm
Subject: Re: [Jython-dev] test_socket and test_select_new failures on Mac on trunk
> I googled for a way to test connection timeouts and found this link:
> Following up on the suggestion in that thread, I tried connecting to
> IPs 22.214.171.124 and 192.168.179.251 and consistenly got timeouts
> (with time out set to 0.1). Is there a way we can use this methodology
> in "TCPClientTimeoutTest"?
The technique is sound.
However, there is always the remote possibility that the chosen address
will actually exist, in which case the test will fail.
IMO, the probability of the address existing is small enough that I can
live with it: if the test fails, then the tester will probably spot the
problem fairly quickly, especially if we document it clearly.
I'm +1 on this solution, but would like to wait for possible
disagreements before we go ahead with it.
If anyone thinks this is not a good approach, speak up!
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Jython-dev mailing list