So, This weekend was a much longer weekend and I had a few cycles to work on cleaning up some of my code. I ran into a little bit of a Snag. During the conversion, I needed to add the ability for the ESP8266 to send out a UDP broadcast so other ESP8266 can be “AWARE” of other ESP’s on the network and thus allow them to integrate without hardcoding any information given that they are on the same IGMP messaging group. During the update of the code, there was a bit of an issue. After espconn_igmp_join is called it seem’s the UDP packets no longer want to send to the address like normal without receiving a packet first. I’m going to keep on this and see if I can find a resolution. After reviewing the document I didn’t have any luck finding anything that noted the change in handling outgoing UDP packet information so I’ll have to connect with Espressif to find out.

static int ICACHE_FLASH_ATTR igmp_join(uint32_t ip) {
   if( ip ) 
   {
      ip_addr_t ipgroup;
      int ret;
      ipaddr_aton(MULTICAST_ADDR, & ipgroup);
      os_printf("IGMP Joining: %08x %08x, " , ip, ipgroup.addr);
      espconn_sendto(&HTTPUDPptrespconn, UDPResponse, os_strlen(UDPResponse)); //UDP packet send's fine here
      ret = espconn_igmp_join( (ip_addr_t *) & ip, & ipgroup); //At this point SendTo stops
      espconn_sendto(&HTTPUDPptrespconn, UDPResponse, os_strlen(UDPResponse)); //UDP packet fails to send now.
      if (ret != 0) 
      {
         os_printf( " failed, code %d\n " , ret);
      } else {
         os_printf( " joined\n " );
      }
      return 0;
   }
   os_printf( " Failed to obtain current IP\n " );
   return 1;
}

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