diversario / node-ssdp

node.js SSDP client/server.
MIT License
274 stars 117 forks source link

Error: write ENOTSUP #98

Open diegocr opened 5 years ago

diegocr commented 5 years ago
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: write ENOTSUP
    at ChildProcess.target._send (internal/child_process.js:750:20)
    at ChildProcess.target.send (internal/child_process.js:634:19)
    at sendHelper (internal/cluster/utils.js:24:15)

This error is throw in Windows when using node-ssdp from a cluster's worker - long story short, the socket needs to be bind'ed with the exclusive flag set.

See https://github.com/wankdanker/node-discover/issues/18

diegocr commented 5 years ago

Actually there is a quite trivial workaround for this:

const SSDP = require('node-ssdp').Server, server = new SSDP({
            reuseAddr: false,
            sourcePort: {
                port: 1900, exclusive: true
            },
      ......
});

Although this throws the warning:

WARNING: SSDP server `sourcePort` option is set to non-SSDP port....

but meh, it does work now :)