C# way to detect if wifi or ethernet connection has gone down

Posted on 2014-08-20
Last Modified: 2014-08-29

I have  client/Server applications written in c#. I need a good way to detect if the clients wifi or Ethernet connect to the internet has gone down to our server? What would be the best way to do this?

Thank you.
Question by:SkyMagic
    LVL 35

    Expert Comment

    I'd say the best way is to ping the default gateway at the active connection at a regular interval (not too heavy though, maybe every minute or so).
    LVL 30

    Accepted Solution

    A solution for this you can add handlers to the static NetworkAddressChanged and NetworkAvailabilityChanged events implemented by the System.Net.NetworkInformation.NetworkChange class.

    see here:

    Author Closing Comment

    Thank you.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    A short article about a problem I had getting the GPS LocationListener working.
    This is about my first experience with programming Arduino.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now