如何从HttpServlet获取客户端的MAC地址? [英] how to get a client's MAC address from HttpServlet?

查看:959
本文介绍了如何从HttpServlet获取客户端的MAC地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求编写一个收集客户端详细信息的servlet,例如ip,mac address等。



让他的IP非常直接( request.getRemoteAddr())但我找不到一种优雅的方式来获取他的MAC地址。



似乎是合理的,网络服务器有访问数据,如Mac地址等,因为它获取TCP数据包和所有。这个数据在哪里注册?可以访问吗?



(我正在Tomcat6上工作)

解决方案

你可能不会得到你想要的东西。 (客户端的MAC地址)



如果服务器足够近(通过集线器或交换机直接连接),您可以


I was asked to write a servlet that collects client's details such as ip, mac address etc.

getting his IP is pretty straight-forward (request.getRemoteAddr()) but I dont find an elegant way to get his MAC address.

seems reasonable that the web server has access to data such as Mac address etc, since it gets the TCP packets and all. does this data registers somewhere? is it accessible?

(I'm working on top of Tomcat6)

解决方案

You're probably not going to get what you want. (the client's MAC address)

If the server is close enough (directly connected via hub or maybe a switch) you can ARP for the MAC Address. If you do this for an IP across the Internet you're probably going to get the inside interface of the closest Router or Switch.

Because of the way TCP/IP works the MAC address used in the 'frame' will get ripped off and re-assembled each at each hop the information takes between the server and the host.

Encapsulation

这篇关于如何从HttpServlet获取客户端的MAC地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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