Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

DLNA (SSDP Multicast) discover devices on network

Hi all!

I need to discover the DLNA devices in the network and list them.

As i understand, I must send a package of request in port 1901 and have a listener in the same port to get the requests.

Can you help me with a C example of how to do it?

Thanks!

Comments

  • Hi Gustav,

    I am having similar problem for IoT network, if you happen to know, would you mind sharing the method to discover my devices which are using Mongoose on the network ??

  • Hi Ahmedabad,

    For your case, I recommend using DNS-sd to publish the arduino services in the network.
    You can use a bonjour-like client to discover it.
    https://github.com/mongoose-os-apps/example-dns-sd

    My case is the reverse.
    I need to discover my devices (smarttvs, DLNA servers etc) using the nodemcu as a client.

    Cheers

    Thanked by 1ankit_malpani
  • nliviunliviu Romania

    @gustavocmorais The starting point is https://openconnectivity.org/developer/specifications/upnp-resources/upnp
    Download the upnp specifications and read UPnP-arch-DeviceArchitecture-v2.0-20150220.pdf
    In a mos application issue a udp M-SEARCH request and process the responses.
    Sample code:

      struct mg_connection *udp = mg_connect(
          mgos_get_mgr(), "udp://239.255.255.250:1900", udp_discover_handler, NULL);
    
      mg_printf(udp,
                "M-SEARCH * HTTP/1.1\r\n"
                "Host:239.255.255.250:1900\r\n"
                "ST:ssdp:all\r\n"
                "MAN:\"ssdp:discover\"\r\n"
                "MX:5\r\n\r\n");
    

    udp_discover_handler processes the responses.

    Thanked by 1gustavocmorais
  • Thanks Gustav,

    but wouldn't it require user to know the name of ESP8266 device running MOS ? I am trying to give him a button on mobile app that can discover every esp8266 running my firmware on network without knowing its IP address or name,

    Should I make a function added to RPC which responds with device name and other relevant data to Polling app ? that way, in my mobile app when user clicks discovery button, the app tries RPC for each ip address in that address range ( ex: 192.168.0.2 to 192.168.0.254 ) and list MOS devices based on the reply received ??

    please guide me to right direction.

Sign In or Register to comment.