AsyncUDP listenMulticast not binding to a specific TCPIP Interface #7328
Labels
Status: Needs investigation
We need to do some research before taking next steps on this issue
Milestone
Discussed in #7327
Originally posted by babushona October 6, 2022
Hello,
What is the 3rd argument of this function for?
bool AsyncUDP::listenMulticast(const ip_addr_t *addr, uint16_t port, uint8_t ttl, tcpip_adapter_if_t tcpip_if)
I have started ESP32 in AP+STA mode. AP got the address 192.168.4.1. STA connected to my home network and got IP address 192.168.5.188.
I wanted the UDP multicast to be listened for only on my AP interface (not on STA interface).
Following is my test code, mostly borrowed from Multicast Example of AsyncUDP library.
After booting ESP32 with this code, I connect my laptop to ESP AP and get IP address 192.168.4.2. Now my laptop and ESP AP interface are on same network. I used PacketSender to send a UDP packet to 239.1.2.3:1234. It gets received by ESP32, as expected.
Then I disconnect my laptop from ESP AP, and connect to my home network. It gets IP address 192.168.5.165. Now my laptop and ESP STA interface are on same network. Using PacketSender, I again send same multicast packet to 239.1.2.3.4:1234. This time, I wasn't expecting this multicast packet to be received by ESP32. But, it received the packet. And surprisingly, it received it on STA interface where there should not be any listener at all.
This is the Serial monitor output.
I am not sure whether this is a bug in the AsynUDP library or I am misinterpreting the multicast behavior. What I expect is, by specifying the 3rd argument of ListenMulticast as "AP", multicast will be listened for only at AP interface. Is this correct expectation?
Thanks for any help.
The text was updated successfully, but these errors were encountered: