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

Client only sends on 1 network interface #21

Open
TimoteusRuotsalainen opened this issue Nov 18, 2022 · 2 comments
Open

Client only sends on 1 network interface #21

TimoteusRuotsalainen opened this issue Nov 18, 2022 · 2 comments

Comments

@TimoteusRuotsalainen
Copy link

TimoteusRuotsalainen commented Nov 18, 2022

Currently the client sends multicast on the first interface. If the computer has multiple network cards then it would be good to be able to specify which one is used.

Here is an implementation for setting the interface

// E1.31 client object constructor
function Client(arg, port) {
  if (this instanceof Client === false) {
    return new Client(arg, port);
  }

  if (arg === undefined) {
    throw new TypeError('arg should be a host address, name or universe');
  }

  this.host = Number.isInteger(arg) ? e131.getMulticastGroup(arg) : arg;
  this.port = port || e131.DEFAULT_PORT;
  this._socket = dgram.createSocket('udp4');

  this._socket.bind(5568, () => {
    this._socket.setMulticastInterface('10.50.106.2');
  });
}

Is there any preference in how the default is treated? I think one option could be to keep the current functionality and only bind if the the Client is called with a ip address.

There is a pull request for server that implements similar functionality https://github.com/hhromic/e131-node/pull/7/files

@hhromic
Copy link
Owner

hhromic commented Dec 19, 2022

Hi @TimoteusRuotsalainen, I like your proposed implementation better than #7.
Would you prepare a PR that would fix #6 and this issue? I promise to review it and we can merge it asap.
Thanks!

Is there any preference in how the default is treated? I think one option could be to keep the current functionality and only bind if the the Client is called with a ip address.

I think best is to make a non-breaking change, so please consider keeping the current behaviour if no specific interface is requested for binding.

@TimoteusRuotsalainen
Copy link
Author

Better late than never 😄

#22

Any comments?

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