开发者

how to get mac address of external IP in C#

how to get mac address of external IP in C# ? E.g I want to find mac address of "204.13.153.34" ?

Any ideas and code snippet 开发者_开发知识库is highly appreciated ? Thanks in Advance


You should read about the Address Resolution Protocol.

You cannot determine the MAC address of a machine in a different network segment. With ARP you can figure out the MAC address for a given IP address if the machine happens to be in the same segment. Thats what the IP stack is doing. It asks the "net" via ARP who is resonsible for handing packets for an IP address, because the ethernet card does only know MAC addresses.


I don't think that's possible unless you write something on the other end that sends it to you?

EDIT:

This looks like it might be able to help Retrieve MAC Address

EDIT: You cannot get an external MAC address of a user without having local LAN access to them... UNLESS: you have access to a good ARP table and only if the client is connected DIRECTLY to the php server (if there are routers/gateways that NAT the traffic, the returned MAC address will be that of the gateway) - Source

It talks about php but the principal will be the same for C#


Like @EricSchaefer answare, You can't get MAC Address from different network segment. But if it's have same network segment I have already answare at another questions


There's the arp command thats part of TCP/IP (it stands for Address Resolution Protocol), but it only works over LAN.

I don't think that you can do what you wish over the internet. As you'll just get the MAC for the first node.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜