开发者

NetworkInterface is a Wifi Interface?

开发者 https://www.devze.com 2023-02-03 04:06 出处:网络
How to find wifi network i开发者_StackOverflownterface from the returned result of NetworkInterface.getNetworkInterfaces();

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

精彩评论

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