本文介绍了是否可以在java中获取默认网关IP和MAC地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从网站上运行的java applet中找到访问默认网关的IP和MAC地址的方法,这可能吗?

I'm trying to find a way to access the IP and MAC addresses for the default gateway from a java applet to be run on a website, is this possible?

推荐答案

您可以使用 getHardwareAddress 在类 java.net.NetworkInterface http://download.oracle.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress())。我不确定这是否适用于Applet,我自己从未测试过该方法,但如果有的话,这个方法就是那个。

You can get the Mac Address of an interface in Java using the method getHardwareAddress in the class java.net.NetworkInterface (http://download.oracle.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress()). I am not sure if that will work inside an Applet, and I have never tested that method myself, but if something does it, this method is that thing.

这篇关于是否可以在java中获取默认网关IP和MAC地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:10