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
multicastSocket = new WiFiUDP();
if (!multicastSocket ->beginMulticast(WiFi.localIP(),
IPAddress(CoapMultiCastAddress) ,
CoapPort))
{
// error
}
unicast
unicastSocket = new WiFiUDP();
// unicast
if (!unicastSocket->begin(CoapPort))
{
// error
}