Home > Archive > Clipper > March 2004 > Function to see if Internet connection is up
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Function to see if Internet connection is up
|
|
| Norman Perelson 2004-03-27, 11:50 pm |
| Can anyone tell me how Clipper (or any other tool) can tell if the local
network can access the Internet without using ping?
With a dial-on-demand Internet router, pinging an Internet IP number would
either initiate a call or keep the idle timer active.
Any ideas that might help towards developing such a function will be
appreciated.
Thanks
Norman
--
Norman Perelson
http://www.shopkeeper.co.za mailto:norman@shoso.co.za
| |
| Jeff Barnes 2004-03-27, 11:50 pm |
| Xref: kermit comp.lang.clipper:60788
Norman,
This question was asked on the FiveWin NG.
Here was the reply:
********
FUNCTION IsInternet()
********
LOCAL b
WSASTARTUP()
b=GetHostByName('microsoft.com')
WSACLEANUP()
RETURN !(B='0.0.0.0')
*
** eof IsInternet()
(Reply from another user)
> b=GetHostByName('microsoft.com')
This will return an IP address if microsoft.com is in the hosts file.
However, I don't know anybody with microsoft.com in their hosts file, so
this should be fairly successful.
HTH
Jeff
"Norman Perelson" <norman@shoso.co.za> wrote in message
news:y5SdnYqr9_YR6PjdRVn-jA@is.co.za...
> Can anyone tell me how Clipper (or any other tool) can tell if the local
> network can access the Internet without using ping?
> With a dial-on-demand Internet router, pinging an Internet IP number would
> either initiate a call or keep the idle timer active.
> Any ideas that might help towards developing such a function will be
> appreciated.
> Thanks
> Norman
> --
> Norman Perelson
> http://www.shopkeeper.co.za mailto:norman@shoso.co.za
>
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 26/03/2004
| |
| Nick Ramsay 2004-03-27, 11:50 pm |
| On Sat, 27 Mar 2004 11:38:10 -0500, "Jeff Barnes"
<barnesj@sympatico.ca> wrote:
>Norman,
>
>This question was asked on the FiveWin NG.
>Here was the reply:
>
>********
>FUNCTION IsInternet()
>********
>
>LOCAL b
>
> WSASTARTUP()
>
> b=GetHostByName('microsoft.com')
>
> WSACLEANUP()
>
>RETURN !(B='0.0.0.0')
>*
>** eof IsInternet()
>
>(Reply from another user)
>
>This will return an IP address if microsoft.com is in the hosts file.
>However, I don't know anybody with microsoft.com in their hosts file, so
>this should be fairly successful.
>
I think I can see a problem here - a nameserver is still going to have
to give you the answer, so I can't don't how this solution will
prevent the router connecting. This is the programmatic equivalent of
doing:
C:\>NSLOOKUP microsoft.com
isn't it? How is this better than ping?
| |
| Norman Perelson 2004-03-27, 11:50 pm |
|
"Nick Ramsay" <news@nospam.demon.co.uk> wrote in message
news:msob60lrkflkgvvgccp75rr712u73dlgc3@
4ax.com...
> On Sat, 27 Mar 2004 11:38:10 -0500, "Jeff Barnes"
> <barnesj@sympatico.ca> wrote:
>
>
> I think I can see a problem here - a nameserver is still going to have
> to give you the answer, so I can't don't how this solution will
> prevent the router connecting. This is the programmatic equivalent of
> doing:
>
> C:\>NSLOOKUP microsoft.com
>
> isn't it? How is this better than ping?
>
Thanks Jeff, but Nick appears to be correct.
I tried NSLOOKUP and it does initiate a dialout on the router.
But is WSASTARTUP()...GetHostByName() the same? I don't know how to test
this because they are Windows API calls. I was hoping for something
simpler.
I think the best way will be to look for an active process or other flag on
the Linux router that is set when the ppp connection is up. The function I
need must then look for that flag on the router. Any better ideas?
Kind regards
Norman
--
Norman Perelson
http://www.shopkeeper.co.za mailto:norman@shoso.co.za
|
|
|
|
|