سلام دوستان عزیز . در این تاپیک ، کد به دست اوردن اطلاعات از connection های شبکه ای موجود لوکال در c#.net رو براتون آماده کردم.
using System.Net.NetworkInformation;
static void ShowConnectionInfo()
{
// Only proceed if there is a network available.
if (NetworkInterface.GetIsNetworkAvailable())
{
// Get the set of all NetworkInterface objects for the local
// machine.
NetworkInterface[] interfaces =
NetworkInterface.GetAllNetworkInterfaces();
// Iterate through the interfaces and display information.
foreach (NetworkInterface ni in interfaces)
{
// Report basic interface information.
Console.WriteLine("Interface Name: {0}", ni.Name);
Console.WriteLine(" Description: {0}", ni.Description);
Console.WriteLine(" ID: {0}", ni.Id);
Console.WriteLine(" Type: {0}", ni.NetworkInterfaceType);
Console.WriteLine(" Speed: {0}", ni.Speed);
Console.WriteLine(" Status: {0}", ni.OperationalStatus);
// Report physical address.
Console.WriteLine(" Physical Address: {0}",
ni.GetPhysicalAddress().ToString());
static void ShowConnectionInfo()
{
// Only proceed if there is a network available.
if (NetworkInterface.GetIsNetworkAvailable())
{
// Get the set of all NetworkInterface objects for the local
// machine.
NetworkInterface[] interfaces =
NetworkInterface.GetAllNetworkInterfaces();
// Iterate through the interfaces and display information.
foreach (NetworkInterface ni in interfaces)
{
// Report basic interface information.
Console.WriteLine("Interface Name: {0}", ni.Name);
Console.WriteLine(" Description: {0}", ni.Description);
Console.WriteLine(" ID: {0}", ni.Id);
Console.WriteLine(" Type: {0}", ni.NetworkInterfaceType);
Console.WriteLine(" Speed: {0}", ni.Speed);
Console.WriteLine(" Status: {0}", ni.OperationalStatus);
// Report physical address.
Console.WriteLine(" Physical Address: {0}",
ni.GetPhysicalAddress().ToString());