Skip to content

Commit

Permalink
check udp bind options
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Dec 3, 2023
1 parent 14f8b0e commit f04c054
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/transporters/tcp/udp-broadcaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,18 @@ class UdpServer extends EventEmitter {
resolve();
});

host = host || "0.0.0.0";
port = port || 4445;

/** @type {import("dgram").BindOptions} */
const bindOptions = { port, host, exclusive: true };
const bindOptions = { port, address: host, exclusive: true };

server.bind(bindOptions, () => {
try {
if (multicastAddress) {
this.logger.info(
`UDP Multicast Server is listening on ${host}:${port}. Membership: ${multicastAddress}`
`UDP Multicast Server is listening on ${
host || "0.0.0.0"
}:${port}. Membership: ${multicastAddress}`
);
server.setMulticastInterface(host);
server.addMembership(multicastAddress, host);
Expand Down

0 comments on commit f04c054

Please sign in to comment.