Node js socket bind fails with port in use

Hi all!

I am trying to use a node js module in HA Node RED, and I am having troubles with the method used to bind to a socket using dgram implementation.

Here is the code:

try {
            await new Promise((resolve, reject) => {
                socket.on('error', reject);
                socket.on('listening', () => {
                    if (this.#ipAddress.endsWith('.255'))
                        socket.setBroadcast(true);

                    resolve();
                });
                socket.bind(this.#port);
            });

This code bind socket to ‘0.0.0.0:port’, but I get all the time:

Error: bind EADDRINUSE 0.0.0.0:port.

The port is not used at all, I think.

Any help please?

Thank you