Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tips for detecting internet connection, website availability? 2

Status
Not open for further replies.

awaresoft

Programmer
Feb 16, 2002
373
DE
The following is a post I made on West-Wind's message board earlier this week. No responses. Would appreciate hearing what others think on the the topic of "detecting internet connections, website availability and setting internet protocol timeouts". My point of reference is using
West-Wind's wwIPstuff product (highly recommended!), but I'm open to any other ideas, products or techniques.

My slightly modified version of my original West-Wind post follows my signature,

Malcolm

I'm looking for some best practice ideas on for detecting internet connection status, website availability, and setting reasonable timeouts for these activities.

This thread was "inspired" by a customer whose ISP recently had DNS problems resulting in my application "freezing" for about 60 seconds when my http code attempted to download a program update from my site.

In reading the West-Wind message boards archives I came across at least 2 techniques for consideration:

1. Using HTTPPing() to determine if my site is accessable

2. Using wwSocket.Connect() and wwSocket.Receive() to determine if my site is accessible;

My thought is that I should be wrapping my application's website access with some sort of "internet connection ok" AND "website ok" status checks AND THEN ... AFTER these status checks have proven successful, use my wwHttp routines to download the files my application is looking for.

So, I'm looking for feedback on:

1. The concept of wrapping wwHttp access with "internet connection" and "website ok" checks - am I being too paranoid or can I acheive the same results by setting wwHttp properties for fast recovery?

2. Technique for determining if an internet connection is present

3. HTTPPing() and/or wwSocket.Connect() or ??? as a technique for verifying that a website is accessable

4. Reasonable timeout values to use for HTTPPing, wwSocket, and wwHTTP activites
 
2. Technique for determining if an internet connection is present

Faq1251-4969



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike!

Thank you very much - that's exactly what I was looking for. I checked the FAQ before posting but missed this tip because it was tied to the CDO email topic.

Your internet connection status allows me to verify that an internet connection is present. What do you think about an additional test to make sure a website is up and accessible? By accessible I mean that a website may be up but not reachable due to ISP DNS server problems?

This is where I think a socket (wwSocket) or ping (wwPing) request may make sense as an additional check before making an http download request?

What do you think? (Am I being too paranoid?)

Malcolm
 
This is where I think a socket (wwSocket) or ping (wwPing) request may make sense as an additional check before making an http download request?

What do you think? (Am I being too paranoid?)

The ability to determine accessibility to a website is not being paranoid. But honestly I don't know what wwPing and wwSocket (West Wind stuff perhaps), and I don't use them. I would use GetRTTAndHopCount API call to ping and Winsock directly rather than using classes.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I would give you another star if I could. Here's what I came up after researching this topic more:

Code:
* ?hasInternetPing( "\\Server" )        && LAN
* ?hasInternetPing( "smtp.mydomain" )	&& SMTP
* ?hasInternetPing( "[URL unfurl="true"]www.mydomaincom"[/URL] )	&& HTTP
*
function hasInternetPing( pcUrl )
  declare integer IsDestinationReachable in sensapi.dll;
    string pcUrl, integer @pnQOC

  * lnQOC is the quality of connection 
  * NOTE: 0= ???, 1=LAN, 2=WAN/dialup
  local lnQOC
  lnQOC = 0

  local lbReachable
  lbReachable = isdestinationreachable( pcUrl, lnQOC ) <> 0
  
  return lbReachable
endfunc

Hope this helps someone else and thanks again for your help!

Malcolm
 
On the same line of thought is there any call that would tell us if an internet connection is available/connected/dis-connected, etc.?

I have an automatic update download manager that I'd like to improve it's function with better information as to the state of a machine's internet connection....


Andy Snyder
SnyAc Software Services
 
Andy,

Check out Mike's original post in this topic: FAQ1251-4969

While this FAQ provides an email solution, part of the solution is code that checks for a live internet connection. I think you may have been confused by this FAQ's title which is email related. When I first saw Mike's reply and visited the FAQ, I thought Mike had posted the wrong FAQ. Then I went back and read the FAQ and its code and found the solution I was looking for (and I think the solution you are looking for as well).

Malcolm
 
SnyAc

To check for an Internet connection try this:

How to know if user is connected faq1253-4952

Credit to craigsboyd [thumbsup2]

Not sure if this is what your looking for but we used it for an app that needed to check for an Internet connection before the user coud download updates.

Lee

Visual FoxPro Versions: 6 & 9
Operating System: Windows XP
 
Lee,

Thanks for pointing out that FAQ 1253-4952. I must be blind but I missed it.

In a similar thread on Rick Strahl's message board, Rick cautioned that some API's like the solution I posted above may be blocked by some firewalls. I'm not sure if this caution would apply to FAQ 1253-4952 as well? Anyway, Rick's advice was to use the protocol that you're using to check for updates as the basis for determining whether a site was available or not.

If you're interested, here's a links to the thread on Rick's messageboard.


My original question has been answered. Thank you all for your help!

Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top