how to get mac address of external IP in C#

后端 未结 4 1032
再見小時候
再見小時候 2021-01-21 00:39

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<

相关标签:
4条回答
  • 2021-01-21 01:14

    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.

    0 讨论(0)
  • 2021-01-21 01:15

    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

    0 讨论(0)
  • 2021-01-21 01:17

    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 讨论(0)
  • 2021-01-21 01:30

    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#

    0 讨论(0)
提交回复
热议问题