I'm developing a web app in Java (with Spark) and I want it to use JmDNS to be able to find this server in my Android app. I was following steps from JmDNS page with service registration, and my code looks like this:
try {
// Create a JmDNS instance
JmDNS jmdns = JmDNS.create(InetAddress.getLocalHost());
// Register a service
ServiceInfo serviceInfo = ServiceInfo.create("_http._tcp.local.", "smart_dom", 4567, "path=index.html");
jmdns.registerService(serviceInfo);
} catch (IOException e) {
System.out.println(e.getMessage());
} catch (InterruptedException e) {
e.printStackTrace();
}
I implemented the part about discovering services in my Android app, but it finds nothing. I made some changes according to this question, and even downloaded ZeroConf Browser (it relies on JmDNS), but even this app doesn't see my web app.
My server runs on Windows PC. I know that Windows doesn't support mDNS, but Java should be independant from the platform. What can I be doing wrong?