OLIMEX / ESP32-POE

ESP32 IoT development board with 100Mb Ethernet and 802.3 Power Over Ethernet (POE)
Apache License 2.0
292 stars 110 forks source link

Question about WiFi and Ethernet running simultaneously #36

Open gonzabrusco opened 1 year ago

gonzabrusco commented 1 year ago

Hello. I have one question about how this example works:

https://github.com/OLIMEX/ESP32-POE/blob/master/SOFTWARE/ARDUINO/ESP32_PoE_Ethernet_WIFI_test/ESP32_PoE_Ethernet_WIFI_test.ino

How do you know or how do you force which connection is made using Ethernet and which one is made using WiFi? It not very clear because you always initialize a WiFiClient object but there's no hint of which connection will use to reach internet.

Thanks Gonzalo

DanKoloff commented 1 year ago

No idea, we just combined the two examples and they worked. Might be better idea to ask in the espressif forums for ESP32 or in the Arduino or Arduino for ESP32 forums.

0x0fe commented 1 year ago

clearly this example is not valid, they use the exact same wificlient for both connection with no action to ensure which one connects to which link, besides, IDF doesnt have any mechanism as of now to set a particular client to a particular link, so all this example does is keep connecting via the same link. in this case it must be via wifi probably since it is the last link which has been setup. You can see the ticket i opened here https://github.com/espressif/arduino-esp32/issues/7796 One convoluted way to do it, would be to set wifi off whenever you want to use the ETH link, and set the ETH off whenever you want to use the wifi link, but that doesnt seem very practical, and i dont even know how we can se the ETH off, for wifi you can use

void wifi_off(void){

  WiFi.disconnect(true);
  WiFi.mode(WIFI_OFF);  
}