The bigger problem to me is the delay it would introduce if I tried to
hit a website all the time. It would be noticable, and when I was
disconnected
I'd have to wait however long it takes the connection to time out, which
is not acceptable if I want to use an approach where I do builds very often.
On 12/22/06, Steve Loughran <[EMAIL PROTECTED]> wrote:
Gilles Scokart wrote:
> Unfortunately, I think that detecting that you are offline or online is
> something quiet difficult. So the user will have to pass some
information
> in his ant command line.
>
the big problem is deciding if a system is offline. I've lots of low
level win32 stuff related to network state and while you can be 100%
sure you are offline when there is no lan or modem, the presence of any
of those things (or a WLAN, or an ipaddr outside the 169.* range) does
not mean that you are online. If you cannot reliably tell WTF is going
on in C++, you don't stand a chance in java. Hitting remote sites is the
only way to be sure.
Ant1.7 has an IsReachable condition that does a ping, which wont go
through firewalls. If you want to check a remote http server, then GET
is all you have
How Ant does it:
<target name="probe-offline">
<condition property="offline">
<or>
<isset property="offline"/>
<not>
<http url="http://www.apache.org/"/>
</not>
</or>
</condition>
<echo level="verbose"> offline=${offline}</echo>
</target>
-steve
--
- Eric