Index
2006-06-28 11:26G Gambill : How To Know If an Internet Connection is Active
2006-06-28 12:01Tracy Pearson : RE: How To Know If an Internet Connection is Active
2006-06-28 12:43Ken McGinnis : Re: How To Know If an Internet Connection is Active
2006-06-28 13:18Jack Skelley : Re: How To Know If an Internet Connection is Active
2006-06-28 14:01Jaime Vasquez : Re: How To Know If an Internet Connection is Active
2006-06-28 18:20G Gambill : Re: How To Know If an Internet Connection is Active
2006-06-29 03:04Andy Davies : Re: How To Know If an Internet Connection is Active
2006-06-29 09:51Jack Skelley : Re: How To Know If an Internet Connection is Active
2006-06-30 00:35Ken McGinnis : Re: How To Know If an Internet Connection is Active
2006-06-30 01:37Peter Hart : RE: How To Know If an Internet Connection is Active
Back to top
How To Know If an Internet Connection is Active

Author: G Gambill

Posted: 2006-06-28 11:26:48   Link

How can I determine if an Internet Connection is active for PostCast Server.

I thought about

oIE = createobject( 'internetexplorer.application')

oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

but can't figure out how to programatically test if that was successful.

TIA

George

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

©2006 G Gambill
Back to top
RE: How To Know If an Internet Connection is Active

Author: Tracy Pearson

Posted: 2006-06-28 12:01:02   Link

oIE = createobject( 'internetexplorer.application')

oIE.Navigate2( "http://www.yahoo.com" )

oIE.Document.Body.InnerHTML && should have something other than the 404

error

If you are shipping MSXML 3 for XMLtoCursor you'll have this available

oHTTP = createobj("MSXML2.XMLHttp.3.0")

oHTTP.Open("GET","http://www.yahoo.com")

TRY

oHTTP.Send()

CATCH

oHTTP = .NULL.

ENDTRY

IF ISNULL(oHTTP)

*-- Unable to connect to internet

ENDIF

Tracy

-----Original Message-----

From: G Gambill

Sent: Wednesday, June 28, 2006 12:27 PM

Subject: How To Know If an Internet Connection is Active

How can I determine if an Internet Connection is active for PostCast Server.

I thought about

oIE = createobject( 'internetexplorer.application')

oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

but can't figure out how to programatically test if that was successful.

TIA

George

©2006 Tracy Pearson
Back to top
Re: How To Know If an Internet Connection is Active

Author: Ken McGinnis

Posted: 2006-06-28 12:43:03   Link

Here is some code I use: (I made some changes for obvious reasons and I have not checked this code)

lcURL = "http://www.yahoo.com"

Local ;

lodoc, ;

lcText, ;

loie, ;

llResult

llResult = .T.

Try

loie = Createobject("internetexplorer.Application")

Catch To oException

llResult = .F.

If Vartype(oException)='O' And ssidebug

With oException

ssiMessageBox ( ;

'Error '+Transform(.ErrorNo)+Chr(13)+ ;

' '+.Message+Chr(13)+ ;

' '+.LineContents+Chr(13)+ ;

' '+.Procedure )

Endwith

Endif

Endtry

If !llResult Or !Vartype(loie) = "O"

ssiMessagebox("There is a problem with your Internet connection"+Chr(13)+ ;

"If you are able to access the xxx main web site"+Chr(13)+ ;

"Please report this to xxx")

Return .F.

Endif

*loie.Visible = .T.

loie.Navigate(lcURL)

Inkey(.3) && need a small delay to setup the display.

Do While loie.Busy()

DoEvents

Inkey(.1)

Enddo

lodoc = loie.Document

lcText = lodoc.documentElement.innerText

************* now you can look in lcText to see if it has what you expect from that web site

----- Original Message -----

From: "G Gambill" <gwgambill@gmail.com>

To: <profox@leafe.com>

Sent: Wednesday, June 28, 2006 9:26 AM

Subject: How To Know If an Internet Connection is Active

How can I determine if an Internet Connection is active for PostCast Server.

I thought about

oIE = createobject( 'internetexplorer.application')

oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

but can't figure out how to programatically test if that was successful.

TIA

George

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2006 Ken McGinnis
Back to top
Re: How To Know If an Internet Connection is Active

Author: Jack Skelley

Posted: 2006-06-28 13:18:08   Link

George:

Here is one more way to check...

LOCAL lnDst, lnHop, lnRTT

*

DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi;

INTEGER DestIpAddress, ;

LONG @HopCount, ;

INTEGER MaxHops, ;

LONG @RTT

*

DECLARE INTEGER inet_addr IN ws2_32 STRING cp

*

lnDst = inet_addr("216.109.117.108") && Yahoo IP returns

lnHop = 0

lnRTT = 0

*

IF GetRTTAndHopCount(lnDst, @lnHop, 50, @lnRTT) = 0

*You are NOT currently connected to the internet

CLEAR DLLS GetRTTAndHopCount, inet_addr

return .f.

ELSE

*You are connected to the internet

CLEAR DLLS GetRTTAndHopCount, inet_addr

return .t.

ENDIF

Regards,

Jack Skelley

G Gambill wrote:

> How can I determine if an Internet Connection is active for PostCast

> Server.

>

> I thought about

>

> oIE = createobject( 'internetexplorer.application')

> oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

>

>

> but can't figure out how to programatically test if that was successful.

>

> TIA

>

> George

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

>

[excessive quoting removed by server]

©2006 Jack Skelley
Back to top
Re: How To Know If an Internet Connection is Active

Author: Jaime Vasquez

Posted: 2006-06-28 14:01:31   Link

G Gambill wrote:

> How can I determine if an Internet Connection is active for PostCast

> Server.

>

> I thought about

>

> oIE = createobject( 'internetexplorer.application')

> oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

>

>

> but can't figure out how to programatically test if that was successful.

>

> TIA

>

> George

Hi George:

Declare Integer InternetCheckConnection in Wininet.dll String Url, Long

Flags, Long Reserved

lnResult = InternetCheckConnection("http://leafe.com/",1,0)

If lnResult != 0

Msg = "Connected!"

Else

Msg = "Not connected!"

EndIf

MessageBox(msg)

HTH

Jaime Vasquez

Guatemala, C.A.

©2006 Jaime Vasquez
Back to top
Re: How To Know If an Internet Connection is Active

Author: G Gambill

Posted: 2006-06-28 18:20:53   Link

Jaime,

Thanks, works great.

George

On 6/28/06, Jaime Vasquez <jrvasquez@alexandria.cc> wrote:

>

>

> G Gambill wrote:

> > How can I determine if an Internet Connection is active for PostCast

> > Server.

> >

> > I thought about

> >

> > oIE = createobject( 'internetexplorer.application')

> > oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

> >

> >

> > but can't figure out how to programatically test if that was successful.

> >

> > TIA

> >

> > George

>

>

> Hi George:

>

> Declare Integer InternetCheckConnection in Wininet.dll String Url, Long

> Flags, Long Reserved

>

> lnResult = InternetCheckConnection("http://leafe.com/",1,0)

>

>

> If lnResult != 0

> Msg = "Connected!"

> Else

> Msg = "Not connected!"

> EndIf

>

>

> MessageBox(msg)

>

>

>

>

> HTH

>

>

> Jaime Vasquez

> Guatemala, C.A.

>

>

[excessive quoting removed by server]

©2006 G Gambill
Back to top
Re: How To Know If an Internet Connection is Active

Author: Andy Davies

Posted: 2006-06-29 03:04:29   Link

Declare Integer InternetCheckConnection in Wininet.dll String Url, Long

Flags, Long Reserved

lnResult = InternetCheckConnection("http://leafe.com/",1,0)

?IIF(lnResult = 0,'NOT connected', 'Connected') && NOT connected

* Doesn't work through [our] firewall

* neither does:

!ping leafe.com

* wonder if it uses ping under the hood?

Andrew Davies  MBCS CITP

  - AndyD        8-)#

**********************************************************************

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.

Please contact internet.administrators@manchester.gov.uk with any queries.

**********************************************************************

©2006 Andy Davies
Back to top
Re: How To Know If an Internet Connection is Active

Author: Jack Skelley

Posted: 2006-06-29 09:51:18   Link

Andy:

Probably some form of ICMP request in this API...

For an experiment try the code I posted (hop count) which returns the number of hops to a destination and see if it

passes your firewall. I think it is similar to tracert but returns the hops to the destination.

I know our firewall can be set up to disregard any ICMP requests.

Regards,

Jack Skelley

Andy Davies wrote:

> Declare Integer InternetCheckConnection in Wininet.dll String Url, Long

> Flags, Long Reserved

> lnResult = InternetCheckConnection("http://leafe.com/",1,0)

> ?IIF(lnResult = 0,'NOT connected', 'Connected') && NOT connected

> * Doesn't work through [our] firewall

> * neither does:

> !ping leafe.com

> * wonder if it uses ping under the hood?

>

> Andrew Davies MBCS CITP

> - AndyD 8-)#

>

>

> **********************************************************************

>

> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.

>

> This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.

>

> Please contact internet.administrators@manchester.gov.uk with any queries.

>

> **********************************************************************

>

>

>

[excessive quoting removed by server]

©2006 Jack Skelley
Back to top
Re: How To Know If an Internet Connection is Active

Author: Ken McGinnis

Posted: 2006-06-30 00:35:12   Link

I advise against using ping. I have my routers set so that ping is not returned. I send all ports to the local IP: 192.168.33.254

which does not exist. This is recommended by grc.com. The only open port is 80 (or whatever port you need) on a server.

I think the best idea is to download a web site page that you think will always be present like yahoo.com and examine it to make

sure it is a real site and not 404 or some other error.

----- Original Message -----

From: "Andy Davies" <a.davies@manchester.gov.uk>

To: <profox@leafe.com>

Sent: Thursday, June 29, 2006 1:04 AM

Subject: Re: How To Know If an Internet Connection is Active

Declare Integer InternetCheckConnection in Wininet.dll String Url, Long

Flags, Long Reserved

lnResult = InternetCheckConnection("http://leafe.com/",1,0)

?IIF(lnResult = 0,'NOT connected', 'Connected') && NOT connected

* Doesn't work through [our] firewall

* neither does:

!ping leafe.com

* wonder if it uses ping under the hood?

Andrew Davies MBCS CITP

- AndyD 8-)#

**********************************************************************

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom

they are addressed. If you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.

Please contact internet.administrators@manchester.gov.uk with any queries.

**********************************************************************

[excessive quoting removed by server]

©2006 Ken McGinnis
Back to top
RE: How To Know If an Internet Connection is Active

Author: Peter Hart

Posted: 2006-06-30 01:37:05   Link

Didn't see the original post so maybe on the wrong track here

Would it not be simpler to use something like Karen Kentworthy's Net

Monitor

And be warned when the site is down.

The program comes with source code for VB so could maybe be modified to

run from VFP

http://www.karenware.com/powertools/ptnetmon.asp

Cheers

Peter

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On

Behalf Of Ken McGinnis

Sent: 30 June 2006 06:46

To: ProFox Email List

Subject: Re: How To Know If an Internet Connection is Active

----- Original Message -----

From: "Andy Davies" <a.davies@manchester.gov.uk>

To: <profox@leafe.com>

Sent: Thursday, June 29, 2006 1:04 AM

Subject: Re: How To Know If an Internet Connection is Active

©2006 Peter Hart