6月18日設置
Posted by No Name Ninja - 2009.12.10,Thu
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.NetworkInformation;
namespace ConsoleIpAddress
{
class Program
{
static void Main(string[] args)
{
if (!NetworkInterface.GetIsNetworkAvailable())
{
return;
}
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
if (adapter.OperationalStatus.Equals(OperationalStatus.Up))
{
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (IPAddressInformation ipInfo in properties.UnicastAddresses)
{
IPAddress ip = ipInfo.Address;
if (!IPAddress.IsLoopback(ip))
{
Console.WriteLine("IP = " + ip);
Console.WriteLine("MAC = " + adapter.GetPhysicalAddress());
}
}
}
}
}
}
}
PR
Comments
Post a Comment
カレンダー
カテゴリー
フリーエリア
最新コメント
[05/16 backlink service]
最新記事
(09/18)
(11/17)
(10/03)
(07/21)
(07/20)
最新トラックバック
プロフィール
HN:
No Name Ninja
性別:
非公開
ブログ内検索
最古記事
カウンター
アクセス解析
Template by mavericyard*
Powered by "Samurai Factory"
Powered by "Samurai Factory"