Java - 列出 LAN 上的所有网络打印机
我需要使用Java来获取LAN上属于网络打印机的所有IP地址的列表。我不需要打印到打印机,我只需要找到所有打印机。这是针对 Android 应用程序的。
需要明确的是,我并不是要查找本地计算机上配置的网络打印机。我正在尝试查找网络上可用的所有打印机。
我已经尝试过http://www.velocityreviews.com/ forums/t152882-dynamic-network-printer-discovery-and-administration-via-jcifs-samba-org.html 已经,我在让根 smbfile 使用该代码时遇到了麻烦,因为我的代码将在多个域和网络上运行,所以我无法对其进行硬编码,而且我无法弄清楚如何使用 jcifs 查找当前域。
I need to use Java to get a list of all the IP addresses on the LAN which belong to network printers. I don't need to print to the printers, I just need to find all of them. This is for an android application.
Just to be clear, I'm not trying to find the network printers which are configured on the local machine. I am trying to find ALL the printers which are available on the network.
I've tried http://www.velocityreviews.com/forums/t152882-dynamic-network-printer-discovery-and-administration-via-jcifs-samba-org.html already, and I am having trouble with getting the root smbfile to use that code, as my code will be running on multiple domains and networks so I can't hardcode it, and I can't figure out how to find the current domain using jcifs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到“所有”打印机是相当艰巨的任务。
不过我建议使用 SNMP 来遍历已知端口。
找到
一个好的 SNMP 实现可以在http://www.snmp4j.org/
,这个网站有一个很好地解释了您正在寻找的内容
http://www.irongeek.com/i.php?page=security/networkprinterhacking
Finding "All" printers is fairly tall order.
However I would suggest using SNMP to walk the known ports.
a good SNMP implementation can be found at
http://www.snmp4j.org/
and this site has a good explanation of what you are looking for
http://www.irongeek.com/i.php?page=security/networkprinterhacking