Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Detect internet reachable

Reply
Thread Tools

Detect internet reachable

 
 
Ke Tao
Guest
Posts: n/a
 
      07-18-2007
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

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      07-18-2007
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) kst- <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"
 
Reply With Quote
 
 
 
 
Bill Reid
Guest
Posts: n/a
 
      07-18-2007

Keith Thompson <kst-> 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



 
Reply With Quote
 
Daniel Rudy
Guest
Posts: n/a
 
      07-18-2007
At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following:
> Keith Thompson <kst-> 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
 
Reply With Quote
 
SM Ryan
Guest
Posts: n/a
 
      07-18-2007
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.
 
Reply With Quote
 
Kenneth Brody
Guest
Posts: n/a
 
      07-19-2007
Daniel Rudy wrote:
>
> At about the time of 7/17/2007 10:19 PM, Bill Reid stated the following:
> > Keith Thompson <kst-> 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: <private.php?do=newpm&u=>


 
Reply With Quote
 
David Thompson
Guest
Posts: n/a
 
      08-26-2007
On Tue, 17 Jul 2007 20:39:24 -0700, Keith Thompson <kst->
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are Gizmoproject users reachable via SIP Georg Schwarz VOIP 3 10-31-2005 09:58 PM
router not reachable over a trunk link blu_aqua Cisco 6 04-09-2005 08:30 AM
AOL Now Reachable by Desktop Linux Users Tech.News Computer Support 10 08-27-2004 07:35 PM
Intranet reachable wireless Gerhard Nowak Wireless Networking 0 06-25-2004 07:37 PM
Destination not reachable until destination pings source! PIX501 Dave Cisco 0 02-27-2004 06:15 PM



Advertisments