-
Notifications
You must be signed in to change notification settings - Fork 72
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
Call addMembership() for mdns server socket #375
Call addMembership() for mdns server socket #375
Conversation
Thank you. Interesting. I really wonder why I never had any issue on raspi and macOS. I also had the membership thing in before but it never really made any difference. But maybe this also could describe issues under windows that were reported. I will release the current main branch as 0.6 tomorrow. After this I will check out your changes on my systems. |
@Apollon77 I just come out with a theory and did some test and I think that might be the cause. On Ubuntu (WSL 2), and probably macOS and raspi, membership might be "shared" cross processes. While on Windows it's not. I tried similar script, and adding membership in another process works on Ubuntu but not Windows. And as there are probably already other services setting up mDNS servers on macOS and raspi, so it's not a problem without adding membership again. Test scripts for convenience: script-1.mjs import { createSocket } from "dgram";
const server = createSocket({ type: "udp4", reuseAddr: true });
server.bind(5353, () => {
// server.addMembership("224.0.0.251");
});
server.on("message", (data, { address }) => {
console.log(address, data);
});
const client = createSocket({ type: "udp4", reuseAddr: true });
client.bind(5353, () => {
setInterval(() => client.send("Hello", 5353, "224.0.0.251"), 1000);
}); script-2.mjs import { createSocket } from "dgram";
const server = createSocket({ type: "udp4", reuseAddr: true });
server.bind(5353, () => {
server.addMembership("224.0.0.251");
}); |
Thank you. And yes these might be the reasons. I will test out code mainly to make sure that it "still works" for the systems where it worked before ;-) |
@vilic There was a reportin discord about these erros in log
nodejs: v18.16.1 I think we need to make sure that such error are simply logged and ignored ... |
@Apollon77 Okay I'll send a new PR soon. Possibly due to no network according to some: mafintosh/multicast-dns#34 |
Fixes #374