I'm using Windows XP and I want to know if the local area is available or not?
And if I'm using another OS would that affect on my code?
I'm using Windows XP and I want to know if the local area is available or not?
And if I'm using another OS would that affect on my code?
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
}
}
}
And if I'm using another OS would that affect on my code?
In most cases, yes, unless you consider various versions of Windows to be "another OS".
The networking interfaces of the operating systems vary, because the API's area extensions of the primary language and architecture of the OS.
The source code for ToggleNic shows you how to enable, disable or check for available network connections on windows. This is in C#.