The use of the ESP8266 in the world of IoT

User avatar
By Demolitron
#11382 In SDK 0.9.5 there are now two IGMP functions to support multicast UDP: (*Sorry...This may be a bit of a thread hijack but this part is on topic.)

Code: Select allSin8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip)
Sin8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip)


I use JOIN like this...
Code: Select all    uPnP_Con.pCon = (struct espconn *) os_zalloc(sizeof (struct espconn));
    uPnP_Con.pCon->type = ESPCONN_UDP;
    uPnP_Con.pCon->state = ESPCONN_NONE;

    uPnP_Con.pCon->proto.udp = (esp_udp *) os_zalloc(sizeof (esp_udp));

    uPnP_Con.pCon->proto.udp->local_port = 1900;

    uPnP_Con.pCon->proto.udp->remote_port = 1900;
    uPnP_Con.pCon->proto.udp->remote_ip[0] = 239;
    uPnP_Con.pCon->proto.udp->remote_ip[1] = 255;
    uPnP_Con.pCon->proto.udp->remote_ip[2] = 255;
    uPnP_Con.pCon->proto.udp->remote_ip[3] = 250;

    uPnP_Con.pCon->reverse = NULL;

    espconn_regist_recvcb(uPnP_Con.pCon, slip_uPnP_OnRecieve);   
    espconn_regist_sentcb(uPnP_Con.pCon, slip_uPnP_OnSendComplete);
    espconn_create(uPnP_Con.pCon);

    IP4_ADDR(&uPnP_MulticastIP.ip, 239, 255, 255, 250);
    espconn_igmp_join(&LocalIP.ip, &uPnP_MulticastIP.ip); 


At that point uPnP request come flying in on the "slip_uPnP_OnRecieve" callback with great success!

However, after that I have a problem when sending multicast packets... It seems that the espconn takes the last incoming UDP packet's source IP address and uses that as the RemoteIP for subsequent transmissions. That makes life suck... Before, when using 0.9.3 I could send multicast packets just fine, but had no way to Rx them.

Anyone else seeing this? Anyone else have a hint or solution?

Thanks!