ESP32 Wifi and Ethernet at same time

If you are connected to 2 different networks (one with wifi and another with ethernet), and both are connected to internet,

what connection is used when accessing to internet (for example with AsyncHTTPRequest)?

how to check the one being used (wifi or ethernet?)

Best regards

WiFi.setDefault()
WiFi.isDefault() 
ETH.setDefault()
ETH.isDefault() 

But if none is set as default and both are connected to internet, is it possible to know which one?

static esp_err_t tcpip_adapter_update_default_netif(void)
{
    if (netif_is_up(esp_netif[TCPIP_ADAPTER_IF_STA])) {
        netif_set_default(esp_netif[TCPIP_ADAPTER_IF_STA]);
    } else if (netif_is_up(esp_netif[TCPIP_ADAPTER_IF_ETH])) {
        netif_set_default(esp_netif[TCPIP_ADAPTER_IF_ETH]);
    } else if (netif_is_up(esp_netif[TCPIP_ADAPTER_IF_AP])) {
        netif_set_default(esp_netif[TCPIP_ADAPTER_IF_AP]);
    }

    return ESP_OK;
}

based in that code Stat is over eth and then AP, but enough to know the one connected to inet (or if both are)

Some more info here https://esp32.com/viewtopic.php?t=9808

did you check isDefault()?

IsDefault is not ok since it tells me if it is the default, but it doesnt grant that is the connection being used for internet (you can be connected to that network but that network could no have internet access).

I would like to know which is the local ip being used , with that I would be able to know that interface I'm using.

.localIP()

good day @Juraj i have tried WiFi.setDefault(), WiFi.isDefault() , ETH.setDefault(), ETH.isDefault() both ETH works but for the WiFi it doesnt work. I am using esp32 on arduino ide with its wifi and lan8720.

MY CODE:

void loop() {
  if (elapsed > 1000) {
    ETH.setDefault();
    udpSend("LAN test message");
    WiFi.setDefault();
    udpSend("WiFi test Message");
    elapsed = 0;
  }
}

ERROR CODE:

my_thesis:78:10: error: 'class WiFiClass' has no member named 'setDefault'
   78 |     WiFi.setDefault();
      |          ^~~~~~~~~~

WiFi.STA.setDefault();