- May
- 3,515
- 5
Is there a simple way to detect whether or not an internet connection is
available?
--
Steve
available?
--
Steve
By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!> Is there a simple way to detect whether or not an internet connection is
> available?
> --
> Steve
>
>
>
>
>
>
>
It doesn't have to be all that time consuming. Specify some address that's extremely likely to be there, like your ISP's default router, and a timeout and one iteration, like| IPCONFIG /ALL will tell you if Windows **thinks** there's an internet
| connection. %_IP is probably just as good for that. But you won't
| know if it's usable until you try it ... @PING, perhaps.
Whether or not my cable modem is connected to my router the reports of
both IPCONFIG /ALL and ECHO %_IP are the same. @PING works, but is dependent
on the accessibility of the specified URL. One could try many, and if any
one works, assume the connection exists, but it is timeconsuming even for
one failure.
Interestingly, the WinXP Control Panel applet "Network Connections"
detects a newly made connection, but does not detect disconnection. I'll try
to see if one of the NET.EXE subcommands can be used for this purpose.
--
Steve
ping -n 1 -w 1000 somewhere.close.com
you> | Short answer - No.
> |
> | Long answer - You could use PING and see if you get a response from a
> | known server on the interwebs. Or COPY a known page from a web
> | server or FTP server.
> |
> | I am assuming by "internet connection" you mean that you have a
> | valid LAN connection and IP address but you may or may not have a
> | valid WAN connection.
>
> Thanks for the reply. The issue is esp. pertinent to any mobile
> computer,e.g. a laptop computer with built-in WiFi. When you start it,
the> want to start browsers, mail clients, etc. only if you are connected to
other> WWW.
> The problem with testing internet availability with PING or any
can> check against a single URL is that the specific URL may be down. OTOH I
> ping many sites, and on detecting the first response declare that I am
> connected.
> --
> Steve
>
>
>
>
The problem with testing internet availability with PING or any other check against a single URL is that the specific URL may be down. OTOH I can ping many sites, and on detecting the first response declare that I am connected.
if %@ping[google.com,3] lt -1 if %@ping[microsoft.com,3] lt -1 abort No internet connection!
Is there a simple way to detect whether or not an internet connection is
available?
--
Steve
v:\> tracert -d -h 2 ilucky
Tracing route to lucky.syr.edu [128.230.13.36]
over a maximum of 2 hops:
1 7 ms 5 ms 5 ms 10.236.192.1
2 15 ms 11 ms 12 ms 24.92.246.125
Trace complete.
v:\> echo %@ping[24.92.246.125]
12