I'm trying to register and later discover a custom jmDNS service type, in part it works well but I can't extract the port number or host from the received data. It comes as 0 as host as null.
Service registration:
// Register a service
ServiceInfo serviceInfo = ServiceInfo.create("_myservice._tcp.local.", "example", 8888, "path=index.html");
jmdns.registerService(serviceInfo);
Listener for service discovery:
public void serviceAdded(ServiceEvent event) {
System.out.println("Service added: " + event.getInfo());
ServiceInfo info = event.getInfo();
int port = info.getPort();
System.out.println("Port: " + port);
}
If I change the same code to use type _http it gets the port number correctly.
Is the usage of the port limited to certain types?
Posting here for future reference. This was due to the version used.
Had to use a different repository with newer versions.