Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The question is about general principle of TCP/UDP communication, not as much about SSDP specifics. If controller as an UDP network client opens a socket to a particular remote address (doesn't matter whether multicast or unicast), the local address is an applicable local network adapter address and <strong>some</strong> port number, assigned by OS. It appears random, but OS assigns it carefully to manage uniqueness for all applications using the same network adapter. In Wireshark, you'll see something like:</p> <pre><code>IP, Src: 192.168.1.40 Dst: 239.255.255.250 UDP, Src Port: 42578 Dst Port: 1900 </code></pre> <p>Where <code>192.168.1.40</code> is (outgoing) network address of the controller. The device will have to respond to <code>192.168.1.40:42578</code>. UDP/IP stack implementation gives you that tuple.</p> <p>I recommend reading <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf" rel="noreferrer">UPnP Device Architecture document</a>. Chapter 1 is all about SSDP and exactly the part you are asking: discovery, advertisement and searching.</p> <p><strong>Edit after code added:</strong></p> <p>I don't see any "server" code, any <code>bind()</code>. You are trying to use the same descriptor for sending as well as receiving. Furthermore, you are using <code>read()</code> which is a generic POSIX function for <em>connected</em> resources (when the descriptor is persistent). In general, it looks to me like you have taken TCP client example and just changed the protocol. It won't work with UDP. To receive UDP packets, you must set up a server on your side. UDP doesn't know if some packet "is a response" to some other packet, as with TCP. UDP is <em>connectionless</em>, but you should already know that.</p> <p>I recommend reading up on <em>generic</em> UDP principles, try implement very simple echo server in UDP (<a href="http://www.abc.se/~m6695/udp.html" rel="noreferrer">random good looking start point</a>), and only then pile up SSDP multicasting on it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload