2

Im trying to discover services broadcasted over mDNS on my local network. I use jmDNS java library, i am able to register services, that im able to see from my other devices. However, when i try to discover services, i am not able to discovery anything.

Here is my test code:

public static void main(String[] args) {
    try {
        JmDNS jmdns = JmDNS.create();
        // Wait for some time to allow services to be discovered
        Thread.sleep(5000);

        logger.info("size: " + jmdns.list("_services._dns-sd._udp.local.").length);
        jmdns.close();
    } catch (IOException | InterruptedException e) {
        e.printStackTrace();
    }
}

The list is always empty. I have tried several more specific service types, such as such as _airplay._tcp, but it does not change anything. There are clearly services on the network, as i can see them from other devices and the device where i run this code, using the Bonjour Broweser. I have also made sure that the 5353 port is open for both TCP and UDP..

0

Browse other questions tagged or ask your own question.