Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Connectivity test

Connectivity test

Scheduled Pinned Locked Moved The Weird and The Wonderful
comsysadminquestion
17 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MatthysDT
    wrote on last edited by
    #1

    I came across the following, working on some one else's project:

            pingHost pping = new pingHost();
            //if ping is false then connection issues
            if (!pping.ping("www.google.com")) {
                MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                return;
            }
    

    So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

    A A G S L 10 Replies Last reply
    0
    • M MatthysDT

      I came across the following, working on some one else's project:

              pingHost pping = new pingHost();
              //if ping is false then connection issues
              if (!pping.ping("www.google.com")) {
                  MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                  return;
              }
      

      So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #2

      MatthysDT wrote:

      So, I take it that Google IS the internet.

      Considering how big they've gotten over the years... it's pretty close... :laugh:

      1 Reply Last reply
      0
      • M MatthysDT

        I came across the following, working on some one else's project:

                pingHost pping = new pingHost();
                //if ping is false then connection issues
                if (!pping.ping("www.google.com")) {
                    MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                    return;
                }
        

        So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

        A Offline
        A Offline
        Ankit Maini
        wrote on last edited by
        #3

        I thought only non-programmer check google to test their internet connection :doh: Even I, sometimes open google to check internet cnnection, But on the other hand, what should one code to test their internet connection....:confused:

        M V K 3 Replies Last reply
        0
        • A Ankit Maini

          I thought only non-programmer check google to test their internet connection :doh: Even I, sometimes open google to check internet cnnection, But on the other hand, what should one code to test their internet connection....:confused:

          M Offline
          M Offline
          MatthysDT
          wrote on last edited by
          #4

          Well, in a client-server application you should know the address of the server, so I'd say that's the address you need to ping, or better yet, make a socket connection to the server port. Even if it's only SQL, if you can connect to port 433 (in most cases), you probably have connectivity. Some servers may block ICMP requests, so that's never a good option.

          D 1 Reply Last reply
          0
          • M MatthysDT

            I came across the following, working on some one else's project:

                    pingHost pping = new pingHost();
                    //if ping is false then connection issues
                    if (!pping.ping("www.google.com")) {
                        MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                        return;
                    }
            

            So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

            G Offline
            G Offline
            Gary Wheeler
            wrote on last edited by
            #5

            Someone I know *cough* *cough* once used that approach. They pinged a machine in the building. If the response was successful, the UI for the application was, ahem, altered in a particular way. A checkbox that represented a spectacularly stupid idea was renamed to "Steve mode", where the aforementioned 'Steve' created the idea.

            Software Zen: delete this;

            P 1 Reply Last reply
            0
            • A Ankit Maini

              I thought only non-programmer check google to test their internet connection :doh: Even I, sometimes open google to check internet cnnection, But on the other hand, what should one code to test their internet connection....:confused:

              V Offline
              V Offline
              VallarasuS
              wrote on last edited by
              #6

              ankitmaini wrote:

              Even I, sometimes open google to check internet cnnection,

              70% of Google users uses google to test internet connection :D ;P #FACT May be SystemInformation.NetWork should come into play to test it! :~

              Regards Vallarasu S | BreakingDotNet.blogspot.com

              1 Reply Last reply
              0
              • M MatthysDT

                I came across the following, working on some one else's project:

                        pingHost pping = new pingHost();
                        //if ping is false then connection issues
                        if (!pping.ping("www.google.com")) {
                            MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                            return;
                        }
                

                So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                S Offline
                S Offline
                sergiogarcianinja
                wrote on last edited by
                #7

                Sometimes you have network but not internet. The better way to test it, is to use a well know network host or IP. If you only want to check if you have network connection and it is good, check for a host like Google is the better choice. Or, you can check for a Registrar, like 'registro.br' here in Brazil. But I rely more on Google than an Registrar, 'cause I never saw and never heard someone speaking that Google was down.

                1 Reply Last reply
                0
                • M MatthysDT

                  I came across the following, working on some one else's project:

                          pingHost pping = new pingHost();
                          //if ping is false then connection issues
                          if (!pping.ping("www.google.com")) {
                              MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                              return;
                          }
                  

                  So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  A LAN in the same building is not the internet. Works as intended :)

                  1 Reply Last reply
                  0
                  • A Ankit Maini

                    I thought only non-programmer check google to test their internet connection :doh: Even I, sometimes open google to check internet cnnection, But on the other hand, what should one code to test their internet connection....:confused:

                    K Offline
                    K Offline
                    kmoorevs
                    wrote on last edited by
                    #9

                    internetgetconnectedstate has always worked for me. You still have to check the availability of the resource.

                    "Go forth into the source" - Neal Morse

                    1 Reply Last reply
                    0
                    • M MatthysDT

                      I came across the following, working on some one else's project:

                              pingHost pping = new pingHost();
                              //if ping is false then connection issues
                              if (!pping.ping("www.google.com")) {
                                  MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                                  return;
                              }
                      

                      So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                      T Offline
                      T Offline
                      Theraot
                      wrote on last edited by
                      #10

                      If the only solution is to check for a web, check for internic.net if internic.net fails then it is as good as the end of the (internet) world. I have made a web search to the subject and there are examples taking the same approach you describe. Sure there are APIs to test for network connection. Then again what exactly do we call Internet? (in particular with ACTA around the corner). It may be better idea to identify the ISP server address and check for that, then again there is the risk of a broken suboceanic cable or a satelite failure... although I understand that USA will probably not notice that, I'm not in USA. You could check for some national, institutional .gov website, until it got attacked with denial of service. By the way, will that software work properly in china or under other government firewall that decides that google is no good? Allow be to doubt it (there is always the risk that another party will use that name, and "poison" the DNS... may be on government's behalf). Talking about DNS, you could have a host files, or local DNS server that says that google is localhost, and the same goes for internic.net. Which is good, because you may want to mock Internet for testing (and survive the so claimed Maya's predictions). The best solution is not to test for Internet, but test for what you need on Internet, for example microsoft products will check for microsoft.com, not because their developers think microsoft.com is the Internet, but because it is the part of the Internet they need to work. For the case of P2P or similar solutions don't even test, let the connection fail.

                      1 Reply Last reply
                      0
                      • G Gary Wheeler

                        Someone I know *cough* *cough* once used that approach. They pinged a machine in the building. If the response was successful, the UI for the application was, ahem, altered in a particular way. A checkbox that represented a spectacularly stupid idea was renamed to "Steve mode", where the aforementioned 'Steve' created the idea.

                        Software Zen: delete this;

                        P Offline
                        P Offline
                        patbob
                        wrote on last edited by
                        #11

                        A reverse easter egg.. I love it :D

                        We can program with only 1's, but if all you've got are zeros, you've got nothing.

                        1 Reply Last reply
                        0
                        • M MatthysDT

                          I came across the following, working on some one else's project:

                                  pingHost pping = new pingHost();
                                  //if ping is false then connection issues
                                  if (!pping.ping("www.google.com")) {
                                      MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                                      return;
                                  }
                          

                          So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                          M Offline
                          M Offline
                          Moshe Katz
                          wrote on last edited by
                          #12

                          I seem to recall a Google blog post (though I can't find it again) that said they leave themselves open to ICMP on purpose specifically so that people can use them to test Internet Access. Also, Microsoft uses a similar idea for the Network Connectivity Icon in Windows. See http://blog.superuser.com/2011/05/16/windows-7-network-awareness/[^] I don't know exactly what URL Apple uses but my iPod touch does the same thing.

                          M 1 Reply Last reply
                          0
                          • M Moshe Katz

                            I seem to recall a Google blog post (though I can't find it again) that said they leave themselves open to ICMP on purpose specifically so that people can use them to test Internet Access. Also, Microsoft uses a similar idea for the Network Connectivity Icon in Windows. See http://blog.superuser.com/2011/05/16/windows-7-network-awareness/[^] I don't know exactly what URL Apple uses but my iPod touch does the same thing.

                            M Offline
                            M Offline
                            MatthysDT
                            wrote on last edited by
                            #13

                            Thank you, you answered some remaining questions I still had on the topic.

                            1 Reply Last reply
                            0
                            • M MatthysDT

                              I came across the following, working on some one else's project:

                                      pingHost pping = new pingHost();
                                      //if ping is false then connection issues
                                      if (!pping.ping("www.google.com")) {
                                          MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                                          return;
                                      }
                              

                              So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                              R Offline
                              R Offline
                              RCoate
                              wrote on last edited by
                              #14

                              MatthysDT wrote:

                              pping.ping

                              Isn't that Ricochet Rabbit[^]

                              1 Reply Last reply
                              0
                              • M MatthysDT

                                I came across the following, working on some one else's project:

                                        pingHost pping = new pingHost();
                                        //if ping is false then connection issues
                                        if (!pping.ping("www.google.com")) {
                                            MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                                            return;
                                        }
                                

                                So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                                M Offline
                                M Offline
                                Moshe Katz
                                wrote on last edited by
                                #15

                                I just got this from someone else's project:

                                internal static bool IsInternetConnected(string webSite)
                                {
                                bool flag;
                                string str;
                                try
                                {
                                if (webSite == null)
                                {
                                str = "www.google.com";
                                }
                                else
                                {
                                str = webSite;
                                }
                                webSite = str;
                                Dns.GetHostEntry(webSite);
                                flag = true;
                                }
                                catch
                                {
                                flag = false;
                                }
                                return flag;
                                }

                                I think a little more than DNS is required to check internet connectivity.

                                1 Reply Last reply
                                0
                                • M MatthysDT

                                  I came across the following, working on some one else's project:

                                          pingHost pping = new pingHost();
                                          //if ping is false then connection issues
                                          if (!pping.ping("www.google.com")) {
                                              MessageBox.Show("The application is unable to connect to the internet and cannot continue.")
                                              return;
                                          }
                                  

                                  So, I take it that Google IS the internet. What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building. I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests. :rolleyes: (Maybe that's the event the Mayans predicted for 21 December 2012?)

                                  M Offline
                                  M Offline
                                  Member 7833521
                                  wrote on last edited by
                                  #16

                                  I have to say that just checking for one web address is pretty poor! In order to determine if an internet end point is available, check to see if the connection is there (via Ping, or what ever) and this if the timeout (only needs to be short) fails, then try the next node that will serve the desired result. once you have run out of nodes to check then you are offline. You may wish to try again later... There may be blips at an endpoint caused by many events (power outage, load balancers, etc) which could (and do) lead to momentary drop outs. It is just that most browsers have quite a good timeout that they "just work" and the end user notices only a slightly slower page load than some drastic moment at a data centre! But then I could be wrong!

                                  1 Reply Last reply
                                  0
                                  • M MatthysDT

                                    Well, in a client-server application you should know the address of the server, so I'd say that's the address you need to ping, or better yet, make a socket connection to the server port. Even if it's only SQL, if you can connect to port 433 (in most cases), you probably have connectivity. Some servers may block ICMP requests, so that's never a good option.

                                    D Offline
                                    D Offline
                                    Dan Neely
                                    wrote on last edited by
                                    #17

                                    How do you differentiate between "Our server has gone boom, hoepfully our internal monitoring app has paged a sysadmin to fix it." and "Your Internet connection is busted; yell at your ISP." Testing several major internet sites is really the only way to go there since I've encountered more than a few cases where something in my/my isps networking gear went splat and Windows never got a clue.

                                    Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups