title: How I can receive UDP multicast from all subnets?
body: <p>The following code receive only UDP multicast in my subnet.
  How I can receive UDP multicast from all subnets?</p>
  
  <pre class="lang-c prettyprint-override"><code>    sd = socket(AF_INET, SOCK_DGRAM, 0);
      int reuse = 1;
      setsockopt(sd, SOL_SOCKET, SO_REUSEADDR,
              (char *) &amp;reuse, sizeof(reuse));
  
      memset((char *) &amp;localSock, 0, sizeof(localSock));
      localSock.sin_family = AF_INET;
      localSock.sin_port = htons(1900);
      localSock.sin_addr.s_addr = INADDR_BROADCAST;
  
      bind(sd, (struct sockaddr*) &amp;localSock, sizeof(localSock));
  
      group.imr_multiaddr.s_addr = inet_addr("239.255.255.250");
      group.imr_interface.s_addr = inet_addr("192.168.3.2");
  
      setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
              (char *) &amp;group, sizeof(group));
  
  
      /* Read from the socket. */
  </code></pre>