I am unable to discover my zebra printer in the same subnet based on the java code but if I provide the list of IP address then I am able to discover it. Below I am adding the code that I used to discover the device.
import java.util.ArrayList;
import java.util.List;
import com.zebra.sdk.printer.discovery.DiscoveredPrinter;
import com.zebra.sdk.printer.discovery.DiscoveryException;
import com.zebra.sdk.printer.discovery.DiscoveryHandler;
import com.zebra.sdk.printer.discovery.NetworkDiscoverer;
/**
*
*
*/
public class NetworkCardDiscovererExample {
public static void main(String[] args) {
List printersToFind = new ArrayList();
printersToFind.add("aaa.aaa.aaa.aaa");
DiscoveryHandler discoveryhandler = new DiscoveryHandler() {
List printers = new ArrayList();
@Override
public void foundPrinter(DiscoveredPrinter printer) {
// TODO Auto-generated method stub
System.out.print("Adding printer" + printer);
printers.add(printer);
}
@Override
public void discoveryFinished() {
// TODO Auto-generated method stub0
for (DiscoveredPrinter printer : printers) {
System.out.println(printer);
}
System.out.println("Discovered " + printers.size() + " printers.");
}
@Override
public void discoveryError(String message) {
// TODO Auto-generated method stub
System.out.println("An error occured during discovery : " + message);
}
};
try {
int timeout = 3000;
List ipList = new ArrayList();
ipList.add("aaa.aaa.aaa.aaa");
System.out.println("Starting printer discovery.");
NetworkDiscoverer.findPrinters(discoveryhandler, ipList, timeout);
} catch (DiscoveryException e) {
e.printStackTrace();
}
}
}
In the above code it's not possible to discover if I remove the iplist.
Unable to discover printer |
2 Replies
I've seen network discovery with card printers fail with a customers site, in that case local network multicast packets were disabled on the network in question due to security requirements preventing discovery of printers.
I've found a few posts on various forums that discuss their disabling with the windows firewall and in the network card via registry settings.
https://superuser.com/questions/788347/how-do-i-disable-multicast-on-the...
I use the SDK for Microsoft .Net, I have a ZT410 printer installed on my development computer (the printer is connected to the network), when I run the Sample demo application (DeveloperDemo_Windows) and go to the Discovery demo, the application detects my printer when I select Directed Broadcast as the discovery method and enter my printer IP address, but none of the other discovery methods work, the Local Broadcast discovery method for example based on the call to NetworkDiscoverer.FindPrinters(discoveryHandler) does not work, neither in my code nor in the demo code.
See video link: https://www.screencast.com/t/q3suP8lHYU9J
Thanks for your help!