I'm running an SSDP server on my raspberry pi using this npm https://github.com/diversario/node-ssdp. I'm running into an issue with the server. It sometimes responds to M-SEARCH
packets and sometimes doesn't. Usually when I start up the service it is responsive but after some time it stops responding. When I run tcpdump
on port 1900
on the pi, I can see that no packets are reaching the pi, during the time it is not responding and they do when it is responsive. Any ideas why there is such intermittent behaviour.
Here is my server code, not sure if it would help since it seems like when the packets do reach the server, it does respond properly.
var SSDP = require('node-ssdp').Server
, ssdpServer = new SSDP({
location: require('ip').address() + ':8000',
sourcePort: 1900
});
ssdpServer.addUSN('upnp:rootdevice')
ssdpServer.addUSN('urn:service:jack:api')
ssdpServer.on('advertise-alive', function (heads) {
// console.log('advertise-alive', heads)
})
ssdpServer.on('advertise-bye', function (heads) {
// console.log('advertise-bye', heads)
})
// start server on all interfaces
ssdpServer.start()
console.log("Starting SSDP server on " + require('ip').address() + "...");
process.on('exit', function(){
ssdpServer.stop() // advertise shutting down and stop listening
})
Thanks!
via Ameya Savale
No comments:
Post a Comment