3

I'm building an application for iOS and Android in angular/cordova where I want to find the IP and port of a certain device on my local network (dynamically), to be able to send post requests and talk to it through its API.

The API says that I could use SSDP or DNS-SD to discover the device. I've looked up these two helpers that could help me get a list of all connected devices on the network:

But as far as I'm concerned node is a server-side framework, I can't just "require" the node modules in my app. Whats the most logical way to go here? I simply want to get a list of all connected devices on my network, is this hard to achieve?

novalain
  • 2,181
  • 19
  • 36
  • _"But as far as I'm concerned this is server-aside code"_: both of the mentioned projects provide client-side code as the first example on their web pages. What is the problem? – Jussi Kukkonen Jul 03 '15 at 11:26
  • Yeah but node is server side technology right? I can't just include it directly in my application. – novalain Jul 03 '15 at 11:59
  • Note: a server side program can be a 'client' to another program! – gabhijit Jul 03 '15 at 12:54
  • @novalain you haven't explained where your code will be running so I didn't know what technologies you can use... I suppose you mean you are building a web app that should run in a normal browser? Doing what you want might be impossible at this point: your app would have to be able to send multicast udp messages and I doubt javascript is allowed to do that in a browser. The W3C and browser developers are working on local discovery (e.g. Firefox does SSDP on it's own) but the features might not be available to web developers yet. – Jussi Kukkonen Jul 03 '15 at 14:21
  • Alright that cleared thing a bit. I'm building the app in cordova so yes technically it should run in a normal browser (on android and ios). I've found some plugins: http://plugins.cordova.io/#/search?search=network, do you think any of these could help me with what I try to achieve? – novalain Jul 04 '15 at 10:57

2 Answers2

0

Try this cordova plugin https://github.com/hsccorp/cordova-plugin-discovery It let you discover any SSDP / UPnP / DLNA service on a local network the hsccorp fork added ios support

Amine Sa
  • 11
  • 1
0

There's a Cordvoa ZeroConf plugin you can use for this:

https://github.com/becvert/cordova-plugin-zeroconf

This detects DNS-SD whereas the Cordova Plugin Discovery (in my tests) did not discover DNS-SD

sMyles
  • 2,418
  • 1
  • 30
  • 44