Detect internet reachable

K

Ke Tao

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
 
K

Keith Thompson

Ke Tao said:
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/>.
 
B

Bill Reid

Keith Thompson said:
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.)...
 
D

Daniel Rudy

At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following:
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.)...

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

SM Ryan

# 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.
 
K

Kenneth Brody

Daniel said:
At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following: [...]
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:[email protected]>
 
D

David Thompson

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top