This time I will show you how to discover Printers over a wifi network, to do this we need to use the jmDNS Java Library which is an implementation of Multi-Cats DNS, a network service discovery service. First of all we need to create a Printer Object which is here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import java.net.InetAddress; public class Printer { private String name; private InetAddress address; public Printer(String name, InetAddress address) { this.name = name; this.address = address; } public String getName() { return name; } public void setName(String name) { this.name = name; } public InetAddress getAddress() { return address; } public void setAddress(InetAddress address) { this.address = address; } @Override public boolean equals(Object o) { if (o instanceof Printer) { Printer printer = (Printer) o; if (printer.name.equals(this.name)) return true; } return false; } } |
This class represents an instance […]