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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to detect network connection?

How to detect network connection?

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadminjsontutorial
3 Posts 3 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.
  • W Offline
    W Offline
    Wenrich
    wrote on last edited by
    #1

    Hi! How to detect whether the network connection is available for a machine running Win2K? What is the API i can use? Thanks a lot!

    G M 2 Replies Last reply
    0
    • W Wenrich

      Hi! How to detect whether the network connection is available for a machine running Win2K? What is the API i can use? Thanks a lot!

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      This depends on what you are using the network connection for. If you want to use WinSock to talk to a remote machine, you can use a ping function. For example, this article[^] provides a C++ class for doing pings. If you need to see if a given network share is available, just try to do a CreateFile or OpenFile on it. You could also use the functions in the Windows shell[^] to enumerate the contents of the 'Network Neighborhood' to find out what shares are available to your machine. In other words, the simple approach is to assume that the network connection is there, and attempt the operation you are interested in. If the operation fails when it otherwise should succeed, in all likelihood the network connection isn't available.


      Software Zen: delete this;

      1 Reply Last reply
      0
      • W Wenrich

        Hi! How to detect whether the network connection is available for a machine running Win2K? What is the API i can use? Thanks a lot!

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        InternetGetConnectedState() will do it for you. --Mike-- "alyson hannigan is so cute it's crazy" -- Googlism Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

        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