MQTT Client bind IP/interface

Posts: 2
Joined: Thu Dec 06, 2018 12:33 pm

MQTT Client bind IP/interface

Postby noiseman » Thu Jun 06, 2019 6:21 pm

Does anybody know if there any way to bind local IP/interface for mqtt client connection?

Now the logic of my app is the following:
1. Connecting Wifi STA
2. Connecting ETH
3. ETH set as default IF with the following function:

esp_err_t setDefaultIf(tcpip_adapter_if_t tcpip_if)
struct netif *_netif;
esp_err_t ret = tcpip_adapter_get_netif(tcpip_if, (void **)&_netif);
if (ret != ESP_OK)
return ret;
return ESP_OK;

4. Connect MQTT client to server

I expects that mqtt client must bind default IF as a local IP/interface, but anyway if STA IF is up MQTT client connects to server via STA IP/interface. If there any way to tell MQTT client to use specific (default) interface?

Thanks in advance.

Who is online

Users browsing this forum: No registered users and 22 guests