ESP32/LAN8720 How to specify LAN/WiFi/WLAN adapter?

Hi,

I connect to an external hardware over ethernet (my board is WT32-ETH01) and get some data via multicast. Now I want to send this data over WiFi/WLAN as broadcast to all connected stations. The ESP32 has opened a working AP. If the ethernet cable is not connected I get a test broadcast on all connected stations. Perfect.
But if the ethernet cable is connected I guess the data will be send over the LAN connection.
My question: How I have to specify which connection is to be used?
I try to broadcast like this:

#include <AsyncUDP.h>
AsyncUDP udp;
...
loop()
{
...
  udp.broadcastTo(packetBuffer, readLen, 12345);
...
}

thanks in advance

for address in LAN, the interface with the same network part in the address is used (of course).

for an address behind the gateway I don't know how LwIP decides which interface has a connection to the right network.

Is the Ethernet on the same subnet as the WIFI AP side?

No.
Ethernet is static on 169.254.x.x / 255.255.0.0
WiFi AP is automatic on 192.168.4.1
But if I send a broadcast there is no IP address that could be matched to any adapter. Or could I do that with the ip net qualifier (192.168)?

this is an interesting problem. Can you even use the Wifi and Ethernet at the same time? The ESP32 looks like talks to the LAN8720 PHY over RMII. You might need to dig into the low level library to determine how to forward a frame to the Wifi over the Ethernet

Thanks 2 all.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.