Question Details    

   Question

Time: 10:56 - Jul 27, 2007     Asked by: dustPuppy      Status: Answered      Points: 75   

how to verify that an internet connection exists from a windows .net application?

I need to verify in the user is connected to the internet.
What is the best, i.e. quickest way to do this?

 
  • Ask a New Question
  • Become a Quomon Expert
  • Current Categories

     

    Other Questions Needing Answers


       
     

    Answer Discussion

    Answer Discussion

    Answer Summaries

    Answer Summary

     
     

    Question & Answer System for Websites and Corporate Intranets

  • Save your corporation money by having common business problems solved once
  • Drive a significant amount of new traffic to your website, products, and services
  • Advertisement

    there is sample code here that may help but note one of the comments. Are you connected to Lan or Internet so suggestion is to use HttpRequest
    http://www.dotnet247.com/247reference/msgs/58/2919...

    I guess you could also ping a website
    http://www.codeproject.com/dotnet/CSharpPing.asp

    Expert:

    nidhi

    Date:

    Jul 27, 2007

    Time:

    11:46

     

    Votes: Good (0) | Bad (0)
    Login to rate this answer

    Thanks for the references, nidhi.
    I decided to use the ping approach like this:
    public bool CheckHostReachable(string host)
    {
    System.Net.NetworkInformation.Ping p = new Ping();

    PingReply pingReply = p.Send(host, 5000);
    return (pingReply.Status == IPStatus.Success);
    }

    I found out that there is also an asynchronous way of pinging, but since I needed the next action to be dependent on whether I had connectivity or not, I decided to use the synchronous way.

    Expert:

    dustPuppy

    Date:

    Jul 28, 2007

    Time:

    06:21

     

    Votes: Good (0) | Bad (0)
    Login to rate this answer

    Yea, I think ping would be the best, at least then it doesnt care about how internet connection is made i.e. lan or modem. Depending on how speed is an issue when checking, you might want to think about hops. Not sure if you can specify how many hops you can make though.

    Expert:

    nidhi

    Date:

    Jul 28, 2007

    Time:

    10:21

     

    Votes: Good (0) | Bad (0)
    Login to rate this answer

    Host Unlimited Domains On 1 Hosting Account

    Question Answered

    This question has been answered, and points have been rewarded to the following experts:

    nidhi: 60
    dustPuppy: 15

    You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.

    No summaries have been submitted yet. Want to be the first?



    Respond to this question:

    New User

      Email:

    Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

    Registered User

    Username:

    Password:


    Forgotten Password

    Enter your email address below and we will resend your login information to you.

    Email:


     


     

    New User

      Email:

    Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

    Registered User

    Username:

    Password:


    Forgotten Password

    Enter your email address below and we will resend your login information to you.

    Email:


     

       

    "Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it


    All Questions


    Language Options

    English:

    www.quomon.com

    Español:

    www.quomon.es

    Quomon Blog

    blog.quomon.com

    Sponsors

    Questions and Answers Software
    Real Estate Postcards
    Marketing Fulfillment