Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By Makuna
#15542 I need to have two listening sockets (Contexts in Esp8266/Arduino speak) for my CoapServer. One for the Multicast and one for a unicast. They both use the same port by CoAp standards.

Which ever one is created first succeeds, but the second one created fails in UdpContext::Listen. The call to udp_bind within UdpContext::Listen returns error code is ERR_USE; meaning the address is in use?

Coap Port is 5684
Coap Multicast Address is 224.0.1.187

By normal socket concepts this should be doable, not so sure by Esp8266 context concepts.

Further, if I just create a multicast socket, while it will receive multicast packets, it will not receive packets sent directly to the ipaddress of the device. This works as I would expect IF I can create the two functional sockets.

here are snippits of the code, just for completeness, they work independently but not when called back to back.

multicast
Code: Select all        multicastSocket = new WiFiUDP();

        if (!multicastSocket ->beginMulticast(WiFi.localIP(),
            IPAddress(CoapMultiCastAddress) ,
            CoapPort))
        {
            // error
        }

unicast
Code: Select all    unicastSocket = new WiFiUDP();

    // unicast
    if (!unicastSocket->begin(CoapPort))
    {
        // error
    }
User avatar
By Makuna
#16475 Just an update. These calls are exclusive, you do one or the other. A new method was added since I originally posted this that allows for the multicast connection to provide the "target" ip of the received packet so you can tell if it was sent by unicast or multicast.

Now my problem is that either of these only accepts about 8 packets before ceasing receiving any more packets.
User avatar
By Makuna
#16844
Makuna wrote:Now my problem is that either of these only accepts about 8 packets before ceasing receiving any more packets.


Well, this turned out to be a problem with a Wifi router. I have two, a primary house hold and a IoT. For some reason still unknown to me the IoT router (different make and model) is causing the problem, either through some strange interaction with the esp8266 or just plain is broken.