me-no-dev / ESPAsyncUDP

Async UDP library for ESP8266
173 stars 56 forks source link

Multicast apperantly broken since sdkupdate in esp8266/Arduino repository #16

Closed Monarch73 closed 5 years ago

Monarch73 commented 7 years ago

Hi..

The following code stopped working since commit 0c897c37a6eab3eab34147219617945a32a9b155 (15oct2017) in the esp8266/Arduino repository. It won't receive SSDP-Broadcasts anymore which is used by UPNP/DLNA Network Devices to announce their services.

When you go back to checkout 2c2d6a3bad29249c6954c2c61a83a3e4ff847da6 (12oct2017), its working again.

I assume it have something to do with the sdk-update...

#include <ESP8266WiFi.h>
#include "ESPAsyncUDP.h"

const char * ssid = "...";
const char * password = "...";

AsyncUDP udp;

void setup() {
   Serial.begin(115200);
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
    if (WiFi.waitForConnectResult() != WL_CONNECTED) {
        Serial.println("WiFi Failed");
        while(1) {
            delay(1000);
        }
    }
    if(udp.listenMulticast(IPAddress(239,255,255,250), 1900)) {
        Serial.print("UDP Listening on IP: ");
        Serial.println(WiFi.localIP());
        udp.onPacket([](AsyncUDPPacket packet) {
            Serial.print("UDP Packet Type: ");
            Serial.print(packet.isBroadcast()?"Broadcast":packet.isMulticast()?"Multicast":"Unicast");
            Serial.print(", From: ");
            Serial.print(packet.remoteIP());
            Serial.print(":");
            Serial.print(packet.remotePort());
            Serial.print(", To: ");
            Serial.print(packet.localIP());
            Serial.print(":");
            Serial.print(packet.localPort());
            Serial.print(", Length: ");
            Serial.print(packet.length());
            Serial.print(", Data: ");
            Serial.write(packet.data(), packet.length());
            Serial.println();
            //reply to the client
            packet.printf("Got %u bytes of data", packet.length());
        });
        //Send multicast
        udp.print("Hello!");
    }
}

void loop() {
  // put your main code here, to run repeatedly:

}
Monarch73 commented 7 years ago

Hi me-no-dev,

can I please get a quick comment from you on this one? Because this one is like really killing me...

stale[bot] commented 5 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.