Detect internet reachable

Discussion in 'C Programming' started by Ke Tao, Jul 18, 2007.

  1. Ke Tao

    Ke Tao Guest

    HI All,

    Is there anybody have an idea of how to detect internet is reachable ?
    At present , I'm using ping to detect internet is reachable , but it's
    maybe a bad idea , some firewall of router may block ping requesting.

    Best Regards,
    Ke Tao
     
    Ke Tao, Jul 18, 2007
    #1
    1. Advertising

  2. Ke Tao <> writes:
    > Is there anybody have an idea of how to detect internet is reachable ?
    > At present , I'm using ping to detect internet is reachable , but it's
    > maybe a bad idea , some firewall of router may block ping requesting.


    Standard C has no network support. You'll need to ask in a form that
    deals with your system. See question 19.40 in the comp.lang.c FAQ,
    <http://www.c-faq.com/>.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jul 18, 2007
    #2
    1. Advertising

  3. Ke Tao

    Bill Reid Guest

    Keith Thompson <> wrote in message
    news:...
    > Ke Tao <> writes:


    > > Is there anybody have an idea of how to detect internet is reachable ?
    > > At present , I'm using ping to detect internet is reachable , but it's
    > > maybe a bad idea , some firewall of router may block ping requesting.

    >
    > Standard C has no network support. You'll need to ask in a form that
    > deals with your system. See question 19.40 in the comp.lang.c FAQ,
    > <http://www.c-faq.com/>.
    >

    Actually, it's worse than that, he probably should first try in some
    group that deals with Internet programming in general, and then he'll
    realize that using ping (or some equivalent activity, such as just
    trying to download a generally-available big commercial home page
    like http://www.yahoo.com, or better, pinging a list of DNS servers)
    is generally about as good as you're gonna be able to do.

    Usually, the only way to know if you're connected to the Internet
    is just to try to download something from the Internet, and a lot of
    purported API functions that promise to tell you your connection
    status at the SYSTEM level either don't work very well or at all, and/or,
    you guessed it, just try to connect to something on the Internet...

    However, you should definitely check them out if available, they
    MAY work for your purposes...it depends a lot on exactly what
    type of connection they are expecting, and in any case you are
    much more likely to be successful if you know PRECISELY the
    connection software/hardware that you are looking for ("default"
    connection software, dial-up vs. LAN, etc.)...

    ---
    William Ernest Reid
     
    Bill Reid, Jul 18, 2007
    #3
  4. Ke Tao

    Daniel Rudy Guest

    At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following:
    > Keith Thompson <> wrote in message
    > news:...
    >> Ke Tao <> writes:

    >
    >>> Is there anybody have an idea of how to detect internet is reachable ?
    >>> At present , I'm using ping to detect internet is reachable , but it's
    >>> maybe a bad idea , some firewall of router may block ping requesting.

    >> Standard C has no network support. You'll need to ask in a form that
    >> deals with your system. See question 19.40 in the comp.lang.c FAQ,
    >> <http://www.c-faq.com/>.
    >>

    > Actually, it's worse than that, he probably should first try in some
    > group that deals with Internet programming in general, and then he'll
    > realize that using ping (or some equivalent activity, such as just
    > trying to download a generally-available big commercial home page
    > like http://www.yahoo.com, or better, pinging a list of DNS servers)
    > is generally about as good as you're gonna be able to do.
    >
    > Usually, the only way to know if you're connected to the Internet
    > is just to try to download something from the Internet, and a lot of
    > purported API functions that promise to tell you your connection
    > status at the SYSTEM level either don't work very well or at all, and/or,
    > you guessed it, just try to connect to something on the Internet...
    >
    > However, you should definitely check them out if available, they
    > MAY work for your purposes...it depends a lot on exactly what
    > type of connection they are expecting, and in any case you are
    > much more likely to be successful if you know PRECISELY the
    > connection software/hardware that you are looking for ("default"
    > connection software, dial-up vs. LAN, etc.)...
    >
    > ---
    > William Ernest Reid
    >
    >
    >


    Even though this is off topic, I usually do a dns lookup on something
    like www.yahoo.com.

    --
    Daniel Rudy

    Email address has been base64 encoded to reduce spam
    Decode email address using b64decode or uudecode -m
     
    Daniel Rudy, Jul 18, 2007
    #4
  5. Ke Tao

    SM Ryan Guest

    Ke Tao <> wrote:
    # HI All,
    #
    # Is there anybody have an idea of how to detect internet is reachable ?
    # At present , I'm using ping to detect internet is reachable , but it's
    # maybe a bad idea , some firewall of router may block ping requesting.

    The internet is an amorphous collection of beellions
    and beellions diverse and oft noncooperative computers.
    The internet is also at times partionned with no notification.

    It makes no real sense to talk about the 'internet' is reachable.

    Instead concern yourself with whether your immediate network
    is reachable, which can be determined by a telephone or ethernet
    carrier detect, and then whether you can reach specific hosts out
    there in the great beyond.

    --
    SM Ryan http://www.rawbw.com/~wyrmwif/
    Raining down sulphur is like an endurance trial, man. Genocide is the
    most exhausting activity one can engage in. Next to soccer.
     
    SM Ryan, Jul 18, 2007
    #5
  6. Daniel Rudy wrote:
    >
    > At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following:
    > > Keith Thompson <> wrote in message
    > > news:...
    > >> Ke Tao <> writes:

    > >
    > >>> Is there anybody have an idea of how to detect internet is reachable ?
    > >>> At present , I'm using ping to detect internet is reachable , but it's
    > >>> maybe a bad idea , some firewall of router may block ping requesting.

    [...]
    > Even though this is off topic, I usually do a dns lookup on something
    > like www.yahoo.com.


    <OT mode="even further" note="so why am I posting this?">
    And when the local router caches DNS and returns an IP, even though
    the other side is disconnected? Or when you can get to "the internet",
    but there is a problem between you and Yahoo's DNS server?

    One needs to define what "internet is reachable" means. And then one
    needs to ask somewhere this is topical.
    </OT>

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
     
    Kenneth Brody, Jul 19, 2007
    #6
  7. On Tue, 17 Jul 2007 20:39:24 -0700, Keith Thompson <>
    wrote:

    > Ke Tao <> writes:
    > > Is there anybody have an idea of how to detect internet is reachable ?
    > > At present , I'm using ping to detect internet is reachable , but it's
    > > maybe a bad idea , some firewall of router may block ping requesting.

    >
    > Standard C has no network support. You'll need to ask in a form that
    > deals with your system. See question 19.40 in the comp.lang.c FAQ,
    > <http://www.c-faq.com/>.


    Although, one of the fairly common hyperbolic 'examples' given here of
    what Undefined Behavior could encompass is to email or post offensive
    and/or embarassing material, such as insults or your porn collection,
    in your name, to various damaging places. So you could try just doing
    *(long long*)13 = 42 and see what happens. <G!>

    - formerly david.thompson1 || achar(64) || worldnet.att.net
     
    David Thompson, Aug 26, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3Vl?=

    Nested usercontrols - system.page not reachable?

    =?Utf-8?B?U3Vl?=, May 19, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    557
    =?Utf-8?B?QWx0YWYgQWwtQW1pbiBOYWp3YW5p?=
    May 21, 2006
  2. Fabian Steiner

    How to test whether a host is reachable?

    Fabian Steiner, Feb 22, 2007, in forum: Python
    Replies:
    5
    Views:
    612
    Bart Ogryczak
    Feb 22, 2007
  3. Tony Johansson
    Replies:
    3
    Views:
    368
    Martin Honnen
    Jul 3, 2010
  4. Yurij Nykon
    Replies:
    2
    Views:
    335
    Grant Wagner
    May 6, 2004
  5. MC
    Replies:
    0
    Views:
    252
Loading...

Share This Page