洪星的博客(原创版,新闻除外)

信息技术 软件开发 电信 移动通信(欢迎和我交流:QQ219402,15152399197)

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  12 随笔 :: 0 文章 :: 62 评论 :: 0 引用

公告

2010年2月27日 #

代码
1 //可以通过比较 NetworkInterface 的 NetworkInterfaceType 筛选不需要的内容
2  NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
3 foreach (NetworkInterface ni in nis)
4 {
5 PhysicalAddress pa = ni.GetPhysicalAddress();
6 string mac = pa.ToString();
7 }
8
9 string myHostName = Dns.GetHostName();
10 IPHostEntry ips = Dns.GetHostEntry(myHostName);
11 foreach (IPAddress ip in ips.AddressList)
12 {
13 string ipString = ip.ToString();
14 }
15

 

posted @ 2010-02-27 16:23 洪星 阅读(1720) 评论(5) 编辑