diff --git a/src/helpers/udp.ts b/src/helpers/udp.ts index d006ce0..a71d4ab 100644 --- a/src/helpers/udp.ts +++ b/src/helpers/udp.ts @@ -84,10 +84,6 @@ export class UDPHelper extends EventEmitter { ) } - if (this.#options.broadcast) { - this.#socket.setBroadcast(true) - } - if (this.#options.ttl !== undefined) { this.#socket.setTTL(this.#options.ttl) } @@ -110,6 +106,11 @@ export class UDPHelper extends EventEmitter { // } // } + // Needed to be called after bind() had completed + if (this.#options.broadcast) { + this.#socket.setBroadcast(true) + } + if (this.#options.multicast_interface) { this.#socket.setMulticastInterface(this.#options.multicast_interface) }