Skip to content

Client only sends on 1 network interface #21

@TimoteusRuotsalainen

Description

@TimoteusRuotsalainen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions