Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - List all network printers on LAN

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.

like image 619
QRohlf Avatar asked May 27 '11 20:05

QRohlf


1 Answers

Finding "All" printers is fairly tall order.

However I would suggest using SNMP to walk the known ports.

a good SNMP implementation cat 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

like image 62
stimpy Avatar answered Oct 14 '22 11:10

stimpy