SSDP Client doesn't find Server advertise
See original GitHub issueI’ve implemented a server/client implementation of node-ssdp using the examples provided. Everything “appears” to work but my client does not pick up the server’s packet. I get a lot of different payloads from different devices/locations but not the payload from my node-ssdp server.
I’m running on the same machine and I’m running on OSX. I have two separate node projects: one for my client and one for my server.
I’ve also verified that the server is actually broadcasting by running:
sudo tcpdump -i en0 -s 0 -B 524288 -w ~/Desktop/DumpFile01.pcap
and then reading the info by
tcpdump -s 0 -n -e -x -vvv -r ~/Desktop/DumpFile01.pcap
Any suggestions? Is it possible that I can’t run the server and client on the same machine?
Here are my implementations just in case I messed something up: Server
var SSDP = require('node-ssdp').Server
, server = new SSDP({
//unicastHost: '192.168.11.63',
location: 'http://' + require('ip').address() + ':33333',
ssdpPort: 33333
})
console.log(require('ip').address())
server.addUSN('upnp:rootdevice')
server.addUSN('urn:schemas-upnp-org:device:MediaServer:1')
server.addUSN('urn:schemas-upnp-org:service:ContentDirectory:1')
server.addUSN('urn:schemas-upnp-org:service:ConnectionManager:1')
server.on('advertise-alive', function (heads) {
console.log('advertise-alive', heads)
// Expire old devices from your cache.
// Register advertising device somewhere (as designated in http headers heads)
})
server.on('advertise-bye', function (heads) {
console.log('advertise-bye', heads)
// Remove specified device from cache.
})
// start server on all interfaces
console.log('starting ssdp server')
server.start()
Client
var ssdp = require('node-ssdp').Client
, client = new ssdp({
// unicastHost: '192.168.11.63'
})
client.on('notify', function () {
//console.log('Got a notification.')
})
client.on('response', function inResponse(headers, code, rinfo) {
console.log('Got a response to an m-search:\n%d\n%s\n%s', code, JSON.stringify(headers, null, ' '), JSON.stringify(rinfo, null, ' '))
})
client.search('ssdp:all')
// Or maybe if you want to scour for everything after 5 seconds
/*setTimeout(function() {
client.search('ssdp:all')
}, 5000)*/
// And after 10 seconds, you want to stop
setTimeout(function () {
client.stop()
}, 10000)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
No, it is UDP multicast, you’re correct. There is likely a bug in the server part of this module because this has came up multiple times.
Could you try this, please:
Adding sourcePort to options seems to fix the problem. Thanks! been trying for a solution =D