Java获取无线网络的SSID等信息
我正在尝试用 Java 获取无线网络设备的 SSID。我尝试了官方网络教程 http://java.sun。 com/docs/books/tutorial/networking/nifs/retrieve.html 但 getDisplayName() getName() 不返回 SSID。有没有办法获得准确的 SSID?另外,我还尝试读取所有网络设备的 WiFi 信号强度,但找不到方法。谁能指导我从哪里获取所有这些信息(教程、代码示例等)?
I'm trying to get the SSID of my wireless network device in Java. I tried the official network tutorials http://java.sun.com/docs/books/tutorial/networking/nifs/retrieving.html but getDisplayName() getName() don't return SSID. Is there a way to get an exact SSID? Also, I'm also trying to read the wifi signal strength of all my network devices and couldn't find a way to do it. Can anyone please direct me from where to get all these information (tutorials, code samples etc)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用纯 Java 无法完成此操作。 Java API 可以让您低至 NetworkInterface 网络堆栈中的级别,但不能低于该级别。当连接到 WiFi 网络时,所有 SSID、握手和安全性工作都在低于该级别的级别完成 - 即依赖于平台的驱动程序。 Java API(从 Java7 开始)不允许您更接近此信息;为此,您必须使用一些依赖于平台的代码。
This cannot be done using pure Java. The Java API can take you as low as the NetworkInterface level in the networking stack, but not lower. When connected to a WiFi network, all SSID, handshaking and security stuff is done in lower levels than that - namely, your platform-dependent driver. The Java API (as of Java7) doesn't let you any closer to this information; you will have to use some platform-dependent code for that.
你看到这个jWlanScan了吗
Did you see this jWlanScan
这是代码示例,其中从 cmd 返回当前连接的无线 SSID
This is code sample where current connected wireless SSID is returned from cmd