开发者

NetworkInterface is a Wifi Interface?

How to find wifi network i开发者_StackOverflownterface from the returned result of

NetworkInterface.getNetworkInterfaces();


That information cannot be obtained using Java. You can only retrieve the interface's name and address(es).


Solution for windows 10 (and probably other platforms):
NetworkInterface.getName() returns a name of pattern <interface type>[<index>], where interface type is one of "lo", "wlan", "eth", "ppp", "net". So your interface's name needs to match the regular expression "wlan\d+".
For searching a wifi adapter among the enumeration NetworkInterface.getNetworkInterfaces() you may also filter by NetworkInterface.isUp(), NetworkInterface.isLoopback() .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜