One of the next steps I am taking is making the ESP8266 aware of other ESP8266 devices and being able to talk to them.
There is a couple way’s I can do this via UDP either with Broadcast or Multicast and I am still planning to figure out what would work best.
One thing I noticed is that as I enable IGMP I am also unable to continue sending RAW udp packets to the multitask group. Well after about an hour of Diag the issue I found that when my socket recieves a packet it update’s the remote PORT and address to reply back specifically to that client and does not revert the address to continue pointing back at the Multicast group 238.255.255.250 thus net new packets continue to send to the last used address.
I created the following code below to copy the address and restore it after the UDP packet is sent out, resolving the issue.

if (espconn_get_connection_info(udpconn,&premot,0) == ESPCONN_OK)
   {

      if(udpconn->link_cnt) {
         os_printf("EspConn %u HTTPUDP connections:\r\n", udpconn->link_cnt);
         int   i = 0;
         while(i < udpconn->link_cnt) {
            os_printf("%d) " IPSTR ":%u %s\r\n", i,  IP2STR(premot[i].remote_ip), premot[i].remote_port, msg_espconn_state[premot[i].state] );
            i++;
         };
      }

      //os_printf("Received device find message\n\r"); 
      //os_sprintf(DeviceBuffer, "%s" MACSTR " " IPSTR, pusrdata, MAC2STR(hwaddr), IP2STR(&ipconfig.ip));
      //os_printf("%s\n", DeviceBuffer);

      remot_info premotbackup;
      premotbackup.remote_port  = udpconn->proto.udp->remote_port; 
      premotbackup.remote_ip[0] = udpconn->proto.udp->remote_ip[0];
      premotbackup.remote_ip[1] = udpconn->proto.udp->remote_ip[1];
      premotbackup.remote_ip[2] = udpconn->proto.udp->remote_ip[2];
      premotbackup.remote_ip[3] = udpconn->proto.udp->remote_ip[3];

      unsigned short strlength = os_strlen(DeviceBuffer);
      udpconn->proto.udp->remote_port = premot->remote_port;
      udpconn->proto.udp->remote_ip[0] = premot->remote_ip[0];
      udpconn->proto.udp->remote_ip[1] = premot->remote_ip[1];
      udpconn->proto.udp->remote_ip[2] = premot->remote_ip[2];
      udpconn->proto.udp->remote_ip[3] = premot->remote_ip[3];

      espconn_sendto(udpconn, SSDPResponse, os_strlen(SSDPResponse)); //Send Back Answer

      udpconn->proto.udp->remote_port  = premotbackup.remote_port;
      udpconn->proto.udp->remote_ip[0] = premotbackup.remote_ip[0];
      udpconn->proto.udp->remote_ip[1] = premotbackup.remote_ip[1];
      udpconn->proto.udp->remote_ip[2] = premotbackup.remote_ip[2];
      udpconn->proto.udp->remote_ip[3] = premotbackup.remote_ip[3];

      //os_printf("SSDPResponse sent: %s\n\r", SSDPResponse); 
      //os_printf("SSDPResponse sent to %s\n\r", IP2STR(&premot->remote_ip));  //Cashes
   }

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax