机器的MAC地址 [英] MAC Address of the machine

查看:71
本文介绍了机器的MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于代码项目中的每一个,我需要完整的源代码来查找机器的MAC地址。我们怎样才能找到系统的MAC地址。请帮帮我。

谢谢提前..

亲切的问候:SADIQ巴基斯坦...

To every one in the code project please i need complete source for finding the MAC address of the machine.That how can we find the MAC address of the system.Please Help me.
Thanks in Advance..
Kind Regards: SADIQ Pakistan...

推荐答案

参考


机器可以有多个网络接口。要查找所有网络接口的MAC地址,请使用以下代码:

Machine can have more than one network interface. To find MAC addresses of all network interfaces use this code:
using System.Net.NetworkInformation;

foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
    Console.WriteLine(string.Format("Interface type: {0}, MAC Address: {1}", nic.NetworkInterfaceType, nic.GetPhysicalAddress()));
}





希望它可以帮助你。



Hope it helps you.


这取决于你的哪台机器谈论你的代码运行的位置。



如果这是你的代码运行的机器,那么网络有大量的例子,大多数都使用WMI,但是其他人使用ARP协议来获取机器中每个网络适配器的MAC地址。



如果您正在谈论获取浏览器客户端的MAC地址从Web应用程序(ASP.NET),你不能这样做。



你最接近的是接口的MAC地址最接近您的Web服务器的路由器。
This depends on which machine your talking about and where your code is running.

If this is the machine that your code is running on, then the web has tons of examples, mostly all using WMI, but others using the ARP protocol, to get the MAC address of every network adapter in the machine.

If you're talking about getting the MAC address of a browser client from a web application (ASP.NET), then you can't do it.

The closest you're going to get is the MAC address of the interface on the router that is closest to your web server.


这篇关于机器的MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆