How to find out if a local area connection is available

I am using Windows XP and I want to know if the local area is available or not?

And if I am using a different OS, will it affect my code?

0


source to share


3 answers


Here's how to do it in Delphi.



0


source


The ToggleNic source code shows you how to enable, disable, or check available network connections in windows. This is in C #.



0


source


Use the following code

using System.Net.NetworkInformation; //(Add reference of System.Net.dll)
public partial class Form1: Form
{
    public Form1()
    {
        InitializeComponent();
        NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
    }
    private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
    {
        if(e.IsAvailable)
        {
            //connected
        }
        else
        {
            //disconnected
        }
    }
}

      

0


source







All Articles