How do I make my application Network-aware ?
Results 1 to 4 of 4

Thread: How do I make my application Network-aware ?

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    2

    How do I make my application Network-aware ?

    I'm developing an application on win2k, and I need to make it aware of the network state oven an ADSL connection. The application must tell the operator when/if the network is out (unplugged cable, router down or ISP down).

    A brute-force approach would be to ping a remote machine periodically, but I'd rather use some native windows event that does the job (i.e. checks the network state) for me.

    I've come across NetworkAvailabilityChanged, but I'm not sure whether it only tells that the cable has been disconnected, or if it tells if the ISP fails.

    Can anyone help me out on:
    1) is NetworkAvailabilityChanged event supported by win2k ?
    2) are there any other nifty ways of checking whether my connection is up&running?

    Thanks

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    186
    What language are you using?
    Ben Franklin said it best. \"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.\"

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    2
    I'm using C/C++ with VC++.

  4. #4
    Senior Member
    Join Date
    May 2003
    Posts
    1,199
    ok, well in order to achieve this you will first need to devise ways to determin what the problem is. so lets start.

    1) cable unplugged. Windows has this built in already, it basicly checks for a signal, any signla on the nic. the flaw? if the router is down no signal is there so you get "network cable unplugged".

    2) is the router up. Ping your default gateway. if ping returns then router is up. the flaw. the router it self could be up for internal use, but may be having trouble with pulling the external IP

    3) Modem down. personnaly I would try and ping a webpage by its domain name AND IP address. only because itis possible that your DNS went out. so ping name, if no good, ping ip. if still no good then MODEM is not connecting.

    from here there isnt much you can do aside from power cycle your modem. If your modem cant sync up then the problem could be your modem, the line comming to the house, the line to the modem, or an outage. none of which you can write software to check.

    but for your progaam you could (im gussing with the very limited knowledge of programming I have) make it something like.

    check for signal on nic

    if yes ping gateway else return "network cable unplugged"

    ping gate way

    if yes ping "ip address" else return "no internet connection"


    or something similar. the problem is like I said before you miss checking if the router is pulling a valid IP from the modem. I dont know how you could check that. but if you get passed that then you need to check the modem.

    this was just a stab at it. figuring out why a netowrk connection isnt working is somewhat difficult only using software. some time thigns just need ot be restarted. and there are so many componentsits hard for software to check all ends.
    Everyone is going to die, I am just as good of a reason as any.

    http://think-smarter.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •