Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JmDNS.create() fails when IPv6 protocol of my network interface is disabled in Windows 10 and JRE 17.0.5 #244

Open
diescalo opened this issue Oct 26, 2022 · 2 comments

Comments

@diescalo
Copy link

Hello,

We develop a plugin for an IDE that was recently updated to use JRE 17 (17.0.5). After that, the multi-cast DNS service we used to discover devices in the local network (thanks to the JMDSN library) stopped working. The only output we receive from the library is a socket exception with message Invalid argument: no further information when the JmDNS.create() method is called.

Yesterday, we were able to figure out a possible cause of this issue. By default and due to some limitations in our intranet, we have IPv6 protocol disabled in our local network interfaces. We have tried enabling it and... voila, the exception was gone and the service started working again.

Haven't made a deep debug yet, but the library seems to fail when trying to open the multicast socket.

Do you have any idea about what could be happening or do you have any workaround that does not imply enabling the IPv6 protocol?

Thanks.

PS: In JRE 11 and 15 it works fine.

@p-inemu
Copy link

p-inemu commented Nov 11, 2022

too. Did you solved it?

@diescalo
Copy link
Author

I investigated it a bit more... Java's NET library has changed in version 17 and it seems that by default the local IP address used for net operations corresponds to IPv6 protocol instead of IPv4. The exception is thrown when creating the multicast socket of the jmdns service if your network interface has IPv6 protocol disabled.

Possible workarounds:

  • Enable IPv6 protocol in the network interface =)
  • Force the use of IPv4 protocol in your application by setting the java.net.preferIPv4Stack system property to true before making use of the Java NET library. This can be easily done with System.setProperty("java.net.preferIPv4Stack", "true")
  • Force the use of IPv4 protocol by executing the application with the VM argument java.net.preferIPv4Stack configured as true. To do so add -Djava.net.preferIPv4Stack=true to your vm launch parameters.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants