locked
Local Area Connection Status RRS feed

  • Question

  • Hi,

    Is there any API available for identifying the local area connection status?

    Thanks!

     

    • Edited by void Func Friday, June 11, 2010 11:25 AM typo
    Friday, June 11, 2010 9:49 AM

Answers

  • System.Net.NetworkInformation provides that, you first call NetworkInterface.GetAllInterfaces() and look for the info you require (OperationalStatus for example).

    Cristian

    • Proposed as answer by Chethan Kamath Friday, June 11, 2010 12:50 PM
    • Marked as answer by void Func Monday, June 14, 2010 3:36 AM
    Friday, June 11, 2010 12:19 PM

All replies

  • System.Net.NetworkInformation provides that, you first call NetworkInterface.GetAllInterfaces() and look for the info you require (OperationalStatus for example).

    Cristian

    • Proposed as answer by Chethan Kamath Friday, June 11, 2010 12:50 PM
    • Marked as answer by void Func Monday, June 14, 2010 3:36 AM
    Friday, June 11, 2010 12:19 PM
  • Check this out.

    http://code.msdn.microsoft.com/WindowsAPICodePack


    Regards, Chethan Kamath. "Remember that if the world didn't suck, we'd all fall off."
    Friday, June 11, 2010 12:20 PM
  • using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Net.NetworkInformation;
    
    namespace Pinger
    {
      class Program
      {
        static void Main(string[] args)
        {
          NetworkInterface[] net = NetworkInterface.GetAllNetworkInterfaces();
    
          foreach (NetworkInterface n in net)
          {
            Console.WriteLine(n.Name + "," + n.OperationalStatus);
          }
        }
      }
    }

    Regards, Chethan Kamath. "Remember that if the world didn't suck, we'd all fall off."
    Friday, June 11, 2010 12:54 PM
  • Tahnk you

    Is there any events available for getting this status?

     

    Friday, June 11, 2010 1:27 PM
  • Have a look at the dosc, you have events for availability changed and network address changed.

    Cristian

    Friday, June 11, 2010 2:03 PM