STA_softAP + UDP broadcast on softAP side problem

chris33
Posts: 9
Joined: Wed Dec 22, 2021 10:35 am

STA_softAP + UDP broadcast on softAP side problem

Postby chris33 » Sat Nov 11, 2023 2:14 pm

Hi all, I'm driving a smart bulb with an ESP32.
The ESP is configured as a sta_softap (no bluetooth stack) and everything is fine : the ESP is connected through STA and the bulb is connected to the AP side.
Then, to have a separation of concerns I create 3 sockets (alongside 3 struct sockaddr_in)
- broadcast_socket
- listener_socket
- sender_socket

Only listener_socket is binded (to the AP side)

What I get
- I can send control messages to the bulb, for hours, controlling the colors without a glitch
- But when I send broadcast messages, I only have the bulb to responds around 2/3 times then stay silent forever. Broadcast messages are sent every 5 seconds, so no network flooding can occur

I dunno if it's a bulb's problem or an UDP broadcast problem.

I connected my Mac to the AP, and with Wireshark I can see the broadcast messages being sent. But, of course, I don't see the bulb->listener_socket traffic because it's not propagated.
At least I know that the broadcast messages are sent.

I'm aware that some traffic loss can occur with UDP broadcast, but 100% seems strange
So, my question is :
- Did some of you had problem with UDP broadcast messages on STA_softAP mode ?
- Is there any settings in VS Code ESP IDF I should try to change ?

Side note : I tried two different bulbs that "may" have different firmwares (I didn't checked for now) :behaviour is the same

chris33
Posts: 9
Joined: Wed Dec 22, 2021 10:35 am

Re: STA_softAP + UDP broadcast on softAP side problem

Postby chris33 » Sun Nov 12, 2023 10:18 am

My bad : when using a static struct to build a packet ALWAYS initialize it with 0s before doing anything else !
Of course, not doing so, the packet will have some wrongly initialized values (from the previous one) ;-)

Who is online

Users browsing this forum: No registered users and 67 guests