从IPv4中的(非本地)IP地址获取MAC地址的最简单方法 [英] Easiest way to get MAC address from a (non-local) IP address in IPv4

查看:81
本文介绍了从IPv4中的(非本地)IP地址获取MAC地址的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法来获取通过TCP/IPv4套接字连接到我的应用程序的计算机的MAC地址?

Is there an easy way to get a MAC address of a machine connected to my app via a TCP/IPv4 socket?

或更笼统地说:

如果我拥有IP地址,那么在IPv4中获取相应MAC地址的最佳方法是什么?

If I have the IP address, what is the best way to get the corresponding MAC address in IPv4?

推荐答案

保留该信息是ARP表的工作.最好的办法是从那里阅读它.

It is the ARP table's job to keep that information. The best thing to do would be to read it out of there.

您可以考虑阅读查询ARP缓存以获取MAC ID的答案.发问者使用的是Java,否则使用的是您相同的问题.

You might consider reading the answers to Query ARP cache to get MAC ID. The questioner was using Java, but otherwise its your identical question.

这篇关于从IPv4中的(非本地)IP地址获取MAC地址的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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