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

addAllNetworkInterfaces -> Only IPv6 sockets can join IPv6 multicast group #6

Closed
Erhannis opened this issue Mar 13, 2021 · 1 comment

Comments

@Erhannis
Copy link
Contributor

My program works on this Linux computer and this Windows computer, but not this Mac computer. Not sure if it's the OS or if it's just something to do with its interfaces. I get the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: Only IPv6 sockets can join IPv6 multicast group
	at sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:811)
	at sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:894)
	at xyz.gianlu.zeroconf.Zeroconf$ListenerThread.addNetworkInterface(Zeroconf.java:586)
	at xyz.gianlu.zeroconf.Zeroconf.addNetworkInterface(Zeroconf.java:188)
	at xyz.gianlu.zeroconf.Zeroconf.addAllNetworkInterfaces(Zeroconf.java:227)
	at com.erhannis.lancopy.JmDNSProcess.<init>(JmDNSProcess.java:128)
	at com.erhannis.lancopy.JmDNSProcess.start(JmDNSProcess.java:158)
	at com.erhannis.lancopy.Frame.main(Frame.java:588)
	at com.erhannis.lancopy.Main.main(Main.java:49)

The relevant code is:

zeroconf0 = new Zeroconf();
zeroconf0.addAllNetworkInterfaces()
         .setUseIpv4(true)
         .setUseIpv6(false);

as I believe I saw in the example file.

@devgianlu
Copy link
Owner

Should be fixed like this:

zeroconf0 = new Zeroconf();
zeroconf0.setUseIpv4(true)
    .setUseIpv6(false);
    .addAllNetworkInterfaces()

devgianlu added a commit that referenced this issue Jun 21, 2021
Update sample code to fix issue #6
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