You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think something in the documentation may be incorrect. In creating a new mdns instance this is one of the option choices:
interface: '192.168.0.2' // explicitly specify a network interface. defaults to all
We were finding that we were only seeing it available on one interface. Looking at index.js:
socket.addMembership(ip, opts.interface)
According to documentation on dgram (the socket), addMembership defaults to a single interface (chosen by the operating system), and if multiple interfaces are desired addMembership should be called multiple times, once per interface. What do you think about taking an array of addresses and calling addMembership on each?
The text was updated successfully, but these errors were encountered:
As far as I know, in addMembership the passed interface is only to restrict what interface you should listen to, but not which to send.
The problem I found is that when sending packets, the system selects one interface based on unknown (to me) rules (it does not select based on routing table, and it changes every couple of minutes).
In order to broadcast in one specific interface, I had to modify the socket binding by including the same opts.interface as it is in the addMembership call.
var bind = thunky(function (cb) {
if (!port) return cb(null)
socket.once('error', cb)
socket.bind(port, opts.interface, function () {
socket.removeListener('error', cb)
cb(null)
})
})
The restriction then is that I cannot pass an encoded interface idx as an IP, and I have to pass the interface IP.
I am not sure if there is another way of controlling what interface to broadcast to, but it would be nice to know :-)
I think something in the documentation may be incorrect. In creating a new mdns instance this is one of the option choices:
We were finding that we were only seeing it available on one interface. Looking at index.js:
According to documentation on dgram (the socket), addMembership defaults to a single interface (chosen by the operating system), and if multiple interfaces are desired addMembership should be called multiple times, once per interface. What do you think about taking an array of addresses and calling addMembership on each?
The text was updated successfully, but these errors were encountered: