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. General Programming
  3. C / C++ / MFC
  4. How to detect Internet connection on machine?

How to detect Internet connection on machine?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
10 Posts 5 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.
  • S Offline
    S Offline
    Sameerkumar Namdeo
    wrote on last edited by
    #1

    I am using CWebBrowser2 wrapper in my dialog based application. In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2. If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control. Can it be detected using CWebBrowser2 ? Thanks.

    B B D 4 Replies Last reply
    0
    • S Sameerkumar Namdeo

      I am using CWebBrowser2 wrapper in my dialog based application. In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2. If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control. Can it be detected using CWebBrowser2 ? Thanks.

      B Offline
      B Offline
      baerten
      wrote on last edited by
      #2

      At least you can realize a ping on a specific server. Propably the CWebBrowser2 has this function... Good luck

      D 1 Reply Last reply
      0
      • S Sameerkumar Namdeo

        I am using CWebBrowser2 wrapper in my dialog based application. In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2. If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control. Can it be detected using CWebBrowser2 ? Thanks.

        B Offline
        B Offline
        bob16972
        wrote on last edited by
        #3

        The FAQ[^]

        1 Reply Last reply
        0
        • S Sameerkumar Namdeo

          I am using CWebBrowser2 wrapper in my dialog based application. In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2. If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control. Can it be detected using CWebBrowser2 ? Thanks.

          B Offline
          B Offline
          bob16972
          wrote on last edited by
          #4

          Or, a slightly more complicated way from Edwin Eefting & Patrick Philippot posted on CodeGuru a while ago that appears to be fairly robust Network connection[^]

          1 Reply Last reply
          0
          • B baerten

            At least you can realize a ping on a specific server. Propably the CWebBrowser2 has this function... Good luck

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            baerten wrote:

            At least you can realize a ping on a specific server.

            Pinging a machine is not reliable. Too many false-positives.


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            B J 2 Replies Last reply
            0
            • S Sameerkumar Namdeo

              I am using CWebBrowser2 wrapper in my dialog based application. In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2. If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control. Can it be detected using CWebBrowser2 ? Thanks.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              ccpptrain wrote:

              If the internet connection is not available on a machine then how can I generally detect that...

              See if this helps.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              1 Reply Last reply
              0
              • D David Crow

                baerten wrote:

                At least you can realize a ping on a specific server.

                Pinging a machine is not reliable. Too many false-positives.


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                B Offline
                B Offline
                baerten
                wrote on last edited by
                #7

                That's right, but in case of no internet connection you have all the time a false result. But it's anyway the latest possibility LOL

                B 1 Reply Last reply
                0
                • D David Crow

                  baerten wrote:

                  At least you can realize a ping on a specific server.

                  Pinging a machine is not reliable. Too many false-positives.


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  DavidCrow wrote:

                  Pinging a machine is not reliable. Too many false-positives.

                  You mean false-negatives? ICMP-requests to a live server filtererd out by a firewall? You need to pick a server with ICMP running and not prone to stop that. I use "www.heise.de" for that. A german publisher of computer magazins with a very dedicated opinion on why ICMP-filterung is bad.


                  Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                  George Orwell, "Keep the Aspidistra Flying", Opening words

                  D 1 Reply Last reply
                  0
                  • J jhwurmbach

                    DavidCrow wrote:

                    Pinging a machine is not reliable. Too many false-positives.

                    You mean false-negatives? ICMP-requests to a live server filtererd out by a firewall? You need to pick a server with ICMP running and not prone to stop that. I use "www.heise.de" for that. A german publisher of computer magazins with a very dedicated opinion on why ICMP-filterung is bad.


                    Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                    George Orwell, "Keep the Aspidistra Flying", Opening words

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    jhwurmbach wrote:

                    You mean false-negatives?

                    Thanks. :-O


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    1 Reply Last reply
                    0
                    • B baerten

                      That's right, but in case of no internet connection you have all the time a false result. But it's anyway the latest possibility LOL

                      B Offline
                      B Offline
                      bob16972
                      wrote on last edited by
                      #10

                      If you have a dial-up, the attempt to query an IP will cause the ISP authentication junk (dialog boxes) to kick in. We tried this back in 2002 and soon realized it caused too many issues on laptops that needed to connect at locations with modems but weren't connected at the time the software was being run. You need to check the routing table, then maybe attempt a ping after you know there is some network connection. There are a couple of different approaches to check for network connectivity before attempting to go out and touch another computer.

                      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