Testing Local Connection / Internet Connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QnNtZW5nZW4=?=

    #1

    Testing Local Connection / Internet Connection

    I am trying to make sure that the local connection is up. I have presently
    been using the NetworkChange.N etworkAvailabil ityChanged Event for this. Is
    there a better way to do this?

    Also, I want to test to see if the Internet Connection is up. I need the
    Internet to be up for the Web Services I am calling. Is it better to test
    the Internet Connection through Pinging an IP Address (I presently do 3 ping
    failures for it to be down) or some other way? Is there any eventhandler out
    there for checking the internet connection?

    Thanks
  • Peter Duniho

    #2
    Re: Testing Local Connection / Internet Connection

    On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen
    <Bsmengen@discu ssions.microsof t.comwrote:
    I am trying to make sure that the local connection is up. I have
    presently
    been using the NetworkChange.N etworkAvailabil ityChanged Event for this.
    Is
    there a better way to do this?
    >
    Also, I want to test to see if the Internet Connection is up. I need the
    Internet to be up for the Web Services I am calling. Is it better to
    test
    the Internet Connection through Pinging an IP Address (I presently do 3
    ping
    failures for it to be down) or some other way? Is there any
    eventhandler out
    there for checking the internet connection?
    The absolute best way to detect whether your web service calls will
    succeed is to try them.

    You can detect network availability, but that obviously won't tell you
    whether you're on the Internet or just a LAN. You also cannot reliably
    know whether the network will become present at some time in the future.
    For example, merely attempting network access is, in some cases,
    sufficient for enabling a network that was not previously present (e.g.
    dial-up network adapter).

    Just because the network's not there when you look, that doesn't mean it
    won't be if you try to do something with it. Likewise, just because it's
    there when you do look, that doesn't mean it will be when you try to do
    something with it.

    Along these same lines is the Internet connectivity issue. The same thing
    applies: just because it's not available when you look, that doesn't mean
    it won't be when you try to use it later, and vice a versa.

    So, your code must handle the error cases anyway, and it's rude to the
    user to provide them with false negatives (not making an attempt to call
    the web service even though it might have worked). So you should just
    ignore the question of whether the network is present and connected to the
    Internet, and just try to use it. If it succeeds, great...if not, tell
    the user and let them deal with it. They have a _lot_ more information
    than your code ever could and can much more successfully handle the issue.

    Pete

    Comment

    • =?Utf-8?B?QnNtZW5nZW4=?=

      #3
      Re: Testing Local Connection / Internet Connection

      Peter,

      Thanks so much for the prompt response.

      However, I am running a standalone application where there is no user around
      to deal with it. I have to deal with it. I am also dealing with FTP issues
      and need both the local connection and internet connection up. Could you
      please explain to me how to best do that in your opinion?

      Thanks again,
      Bob


      "Peter Duniho" wrote:
      On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen
      <Bsmengen@discu ssions.microsof t.comwrote:
      >
      I am trying to make sure that the local connection is up. I have
      presently
      been using the NetworkChange.N etworkAvailabil ityChanged Event for this.
      Is
      there a better way to do this?

      Also, I want to test to see if the Internet Connection is up. I need the
      Internet to be up for the Web Services I am calling. Is it better to
      test
      the Internet Connection through Pinging an IP Address (I presently do 3
      ping
      failures for it to be down) or some other way? Is there any
      eventhandler out
      there for checking the internet connection?
      >
      The absolute best way to detect whether your web service calls will
      succeed is to try them.
      >
      You can detect network availability, but that obviously won't tell you
      whether you're on the Internet or just a LAN. You also cannot reliably
      know whether the network will become present at some time in the future.
      For example, merely attempting network access is, in some cases,
      sufficient for enabling a network that was not previously present (e.g.
      dial-up network adapter).
      >
      Just because the network's not there when you look, that doesn't mean it
      won't be if you try to do something with it. Likewise, just because it's
      there when you do look, that doesn't mean it will be when you try to do
      something with it.
      >
      Along these same lines is the Internet connectivity issue. The same thing
      applies: just because it's not available when you look, that doesn't mean
      it won't be when you try to use it later, and vice a versa.
      >
      So, your code must handle the error cases anyway, and it's rude to the
      user to provide them with false negatives (not making an attempt to call
      the web service even though it might have worked). So you should just
      ignore the question of whether the network is present and connected to the
      Internet, and just try to use it. If it succeeds, great...if not, tell
      the user and let them deal with it. They have a _lot_ more information
      than your code ever could and can much more successfully handle the issue.
      >
      Pete
      >

      Comment

      • Ignacio Machin ( .NET/ C# MVP )

        #4
        Re: Testing Local Connection / Internet Connection

        On Mar 25, 1:34 pm, Bsmengen <Bsmen...@discu ssions.microsof t.com>
        wrote:
        Peter,
        >
        Thanks so much for the prompt response.  
        >
        However, I am running a standalone application where there is no user around
        to deal with it.  I have to deal with it.  I am also dealing with FTP issues
        and need both the local connection and internet connection up.  Could you
        please explain to me how to best do that in your opinion?
        >
        Thanks again,
        Bob
        >
        >
        >
        "Peter Duniho" wrote:
        On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen  
        <Bsmen...@discu ssions.microsof t.comwrote:
        >
        I am trying to make sure that the local connection is up.  I have  
        presently
        been using the NetworkChange.N etworkAvailabil ityChanged Event for this..  
        Is
        there a better way to do this?
        >
        Also, I want to test to see if the Internet Connection is up.  I need the
        Internet to be up for the Web Services I am calling.  Is it better to  
        test
        the Internet Connection through Pinging an IP Address (I presently do 3  
        ping
        failures for it to be down) or some other way?  Is there any  
        eventhandler out
        there for checking the internet connection?
        >
        The absolute best way to detect whether your web service calls will  
        succeed is to try them.
        >
        You can detect network availability, but that obviously won't tell you  
        whether you're on the Internet or just a LAN.  You also cannot reliably  
        know whether the network will become present at some time in the future. 
        For example, merely attempting network access is, in some cases,  
        sufficient for enabling a network that was not previously present (e.g.  
        dial-up network adapter).
        >
        Just because the network's not there when you look, that doesn't mean it 
        won't be if you try to do something with it.  Likewise, just because it's  
        there when you do look, that doesn't mean it will be when you try to do  
        something with it.
        >
        Along these same lines is the Internet connectivity issue.  The same thing  
        applies: just because it's not available when you look, that doesn't mean  
        it won't be when you try to use it later, and vice a versa.
        >
        So, your code must handle the error cases anyway, and it's rude to the  
        user to provide them with false negatives (not making an attempt to call 
        the web service even though it might have worked).  So you should just 
        ignore the question of whether the network is present and connected to the  
        Internet, and just try to use it.  If it succeeds, great...if not, tell  
        the user and let them deal with it.  They have a _lot_ more information  
        than your code ever could and can much more successfully handle the issue.
        >
        Pete- Hide quoted text -
        >
        - Show quoted text -
        Hi,

        It's as simple as trying to conenct to the ftp server, if you can
        connect there is connectivity TO THE SERVER, that is what you care
        about in reality.
        Cause, what would you call it if there is connectivity to the rest of
        the internet but to your server?

        Comment

        • Ignacio Machin ( .NET/ C# MVP )

          #5
          Re: Testing Local Connection / Internet Connection

          On Mar 25, 1:03 pm, Bsmengen <Bsmen...@discu ssions.microsof t.com>
          wrote:
          I am trying to make sure that the local connection is up.  I have presently
          been using the NetworkChange.N etworkAvailabil ityChanged Event for this.  Is
          there a better way to do this?
          >
          Also, I want to test to see if the Internet Connection is up.  I need the
          Internet to be up for the Web Services I am calling.  Is it better to test
          the Internet Connection through Pinging an IP Address (I presently do 3 ping
          failures for it to be down) or some other way?  Is there any eventhandler out
          there for checking the internet connection?
          >
          Thanks
          Hi,

          And what happens if the server is up (you get ping) but the web
          service is down?

          Comment

          • Peter Duniho

            #6
            Re: Testing Local Connection / Internet Connection

            On Tue, 25 Mar 2008 10:34:00 -0700, Bsmengen
            <Bsmengen@discu ssions.microsof t.comwrote:
            However, I am running a standalone application where there is no user
            around
            to deal with it. I have to deal with it.
            Unless you've got a robot controlled by your code that can plug the
            network cable back in, you're stuck.

            My main point is that checking for network conditions before trying to use
            the network doesn't benefit you in any way. If you find that the network
            isn't there, that doesn't mean it won't be there if and when you try to
            use it. And if you find that the network _is_ there, that doesn't mean it
            will still be there if and when you try to use it.
            I am also dealing with FTP issues
            and need both the local connection and internet connection up. Could you
            please explain to me how to best do that in your opinion?
            To do what? If you're asking how to find out whether the connection is
            "up", I've already explained that. If you're asking something else, I
            don't understand the question.

            Pete

            Comment

            • =?Utf-8?B?QnNtZW5nZW4=?=

              #7
              Re: Testing Local Connection / Internet Connection

              Thanks so much for your help.
              --
              Bob


              "Ignacio Machin ( .NET/ C# MVP )" wrote:
              On Mar 25, 1:03 pm, Bsmengen <Bsmen...@discu ssions.microsof t.com>
              wrote:
              I am trying to make sure that the local connection is up. I have presently
              been using the NetworkChange.N etworkAvailabil ityChanged Event for this. Is
              there a better way to do this?

              Also, I want to test to see if the Internet Connection is up. I need the
              Internet to be up for the Web Services I am calling. Is it better to test
              the Internet Connection through Pinging an IP Address (I presently do 3 ping
              failures for it to be down) or some other way? Is there any eventhandler out
              there for checking the internet connection?

              Thanks
              >
              Hi,
              >
              And what happens if the server is up (you get ping) but the web
              service is down?
              >
              >

              Comment

              Working...