DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: wanted: CLI tool to determine if Internet access yes/no  (Read 12,597 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
wanted: CLI tool to determine if Internet access yes/no
« on: April 25, 2006, 05:37 PM »
Hi,

I really could use such a small .exe, that maybe would just ping www.google.com and return the state so that I could use it in AutoHotkey. You know of anything?
Thank you.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #1 on: April 25, 2006, 06:08 PM »
I'm not sure, but i think this has already been done (not sure, but i think by me). Please check on coding snacks.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #2 on: April 25, 2006, 06:14 PM »
I did a forum search (and just now another one) but didn't find anything...  :( Do you remember any key words?
Thank you.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #3 on: April 25, 2006, 06:47 PM »
Ok, now i remember i couldn't quite do this, but got some solutions (i think).
(btw: if you just want to know if the internet access is on or off on ahk, you could use the URLDownloadToFile command, and check what was it's errorlevel. In case the page couldn't be downloaded, the errorlevel will be different from 0.)

Here's the other thread i mentioned: http://www.donationcoder.com/forum/index.php?topic=2999.0

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #4 on: April 25, 2006, 06:55 PM »
(btw: if you just want to know if the internet access is on or off on ahk, you could use the URLDownloadToFile command, and check what was it's errorlevel. In case the page couldn't be downloaded, the errorlevel will be different from 0.)
Right, just trying to download http://www.google.com/index.html should work!  :up:
Thank you.

Cavalcader

  • Live Long & Prosper
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 194
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #5 on: April 26, 2006, 12:29 AM »
What about the ping command that comes with Windows?
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] target_name

Options:
    -t            Ping the specified host until stopped.
                  To see statistics and continue - type Control-Break;
                  To stop - type Control-C.
    -a            Resolve addresses to hostnames.
    -n count      Number of echo requests to send.
    -l size        Send buffer size.
    -f            Set Don't Fragment flag in packet.
    -i TTL        Time To Live.
    -v TOS        Type Of Service.
    -r count      Record route for count hops.
    -s count      Timestamp for count hops.
    -j host-list  Loose source route along host-list.
    -k host-list  Strict source route along host-list.
    -w timeout    Timeout in milliseconds to wait for each reply.
My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #6 on: April 26, 2006, 06:48 AM »
What about the ping command that comes with Windows?
Then I'd need to store the output and check it. I think it's just easier to use jgpaiva's idea.
Thank you.

Cavalcader

  • Live Long & Prosper
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 194
Re: wanted: CLI tool to determine if Internet access yes/no
« Reply #7 on: April 26, 2006, 08:17 PM »
Then I'd need to store the output and check it. I think it's just easier to use jgpaiva's idea.
Aha! After reading the linked thread I see better what you're after. I've used Pingometer with good success (it's mentioned in that thread). There's a related util called WWIP (Watch WAN IP) if you have a router. It'll basically pull an HTML page from it and look for a string that you specify. Great concept to stay current on a dynamic IP address without having to contact an external server, but I realize that's not exactly what you're looking for.
:)
My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?

Original address: https://www.donationcoder.com/forum/index.php?topic=3383.0