question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSDP Client doesn't find Server advertise

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
diversariocommented, Apr 6, 2017

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:

var SSDP = require('node-ssdp').Server
  , server = new SSDP({
    location: 'http://' + require('ip').address() + ':33333',
    sourcePort: 1900
  })
1reaction
kevz93commented, Jun 15, 2017

Adding sourcePort to options seems to fix the problem. Thanks! been trying for a solution =D

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node SSDP Client not finding Server broadcast - Stack Overflow
I've implemented a server/client implementation of node-ssdp ( npm install node-ssdp ). Everything "appears" to work but my client does not ...
Read more >
SSDP Discovery Service not available - Microsoft Community
If SSDP is not listed in services, go to "server manger" - then configuration then services; you'll see SSDP there - once its...
Read more >
General Settings | Media Server - Synology Knowledge Center
By advertising itself, DLNA/UPnP devices can detect that the server is running and can play multimedia contents streamed from the server. To adjust...
Read more >
Internet Accessible SSDP Service
UPnP provides a specification called Simple Service Discovery Protocol (SSDP) that allows devices to dynamically discover the services offered by each other ...
Read more >
SSDP communication not working between VMs - DigitalOcean
ssdpy-discover ssdp:all. The above command does not list anything. There are no execution errors. However on running both server and client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found